Skip to content

[ADD] unpublish_product: auto unpublish products when free_qty is zero#1185

Draft
mekot-odoo wants to merge 1 commit into19.0from
19.0-eCommerce-unpublish-out-of-stock-product-mekot
Draft

[ADD] unpublish_product: auto unpublish products when free_qty is zero#1185
mekot-odoo wants to merge 1 commit into19.0from
19.0-eCommerce-unpublish-out-of-stock-product-mekot

Conversation

@mekot-odoo
Copy link

-Implement automatic unpublishing of products when their free quantity
reaches zero.

-Implement automatic unpublishing of products when their free quantity
 reaches zero.
@robodoo
Copy link

robodoo commented Feb 26, 2026

Pull request status dashboard

Comment on lines +7 to +10
auto_unpublish_out_of_stock = fields.Boolean(
string="Auto Unpublish Out-of-Stock Products",
config_parameter="unpublish_product.auto_unpublish_out_of_stock",
)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

make this setting company dependent, or website dependent 🤔

Comment on lines +7 to +13
def write(self, vals):
res = super().write(vals)

products = self.mapped("product_id.product_tmpl_id")
products.check_and_unpublish()

return res

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't do it on write of quant, do it in product template directly

Comment on lines +2 to +11
"name": "auto unpublish product",
"version": "1.0.0",
"depends": ["base", "product", "website_sale", "stock"],
"author": "Mehul Kotak",
"category": "Task-3",
"description": "eCommerce",
"license": "LGPL-3",
"auto_install": True,
"installable": True,
"data": ["views/res_config_settings_view.xml"],

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't create new module directly update in community, make hook or something like it, it should check direct quantity if stock is not installed then override in website_sale_stock to adept depending on stock

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants