[ADD] unpublish_product: auto unpublish products when free_qty is zero#1185
Draft
mekot-odoo wants to merge 1 commit into19.0from
Draft
[ADD] unpublish_product: auto unpublish products when free_qty is zero#1185mekot-odoo wants to merge 1 commit into19.0from
mekot-odoo wants to merge 1 commit into19.0from
Conversation
-Implement automatic unpublishing of products when their free quantity reaches zero.
kcv-odoo
reviewed
Feb 26, 2026
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", | ||
| ) |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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"], |
There was a problem hiding this comment.
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

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