From e89d2b8ca8060324f9269f7f708b7b63381d41bd Mon Sep 17 00:00:00 2001 From: AjmalCybro Date: Tue, 11 Jun 2024 15:05:43 +0530 Subject: [PATCH] Jun 11 [UPDT] : Updated 'low_stocks_product_alert' --- low_stocks_product_alert/doc/RELEASE_NOTES.md | 6 +++++- low_stocks_product_alert/models/product_product.py | 10 ++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/low_stocks_product_alert/doc/RELEASE_NOTES.md b/low_stocks_product_alert/doc/RELEASE_NOTES.md index 6ca8f2546..6e330c248 100644 --- a/low_stocks_product_alert/doc/RELEASE_NOTES.md +++ b/low_stocks_product_alert/doc/RELEASE_NOTES.md @@ -3,5 +3,9 @@ #### 27.07.2023 #### Version 16.0.1.0.0 #### ADD +- Initial commit for Product Low Stock Alert -- Initial commit for Product Low Stock Alert \ No newline at end of file +#### 10.06.2024 +#### Version 16.0.1.0.1 +##### BUGFIX +- Fixed the error in displaying the alert quantity for individual products diff --git a/low_stocks_product_alert/models/product_product.py b/low_stocks_product_alert/models/product_product.py index c81db3348..82c3d3fd7 100644 --- a/low_stocks_product_alert/models/product_product.py +++ b/low_stocks_product_alert/models/product_product.py @@ -43,6 +43,7 @@ class ProductProduct(models.Model): 'stock alert will be triggered.When the product quantity falls ' 'below this value, the background color for the product will be ' 'changed based on the alert state.', + compute="_compute_is_low_stock_alert" ) min_low_stock_alert = fields.Integer( string='Alert Quantity', @@ -66,3 +67,12 @@ class ProductProduct(models.Model): is_low_stock_single = rec.detailed_type == 'product' and rec.qty_available <= int( rec.min_low_stock_alert) rec.alert_tag = rec.qty_available if is_low_stock_single else False + + @api.depends_context('is_low_stock_alert_individual') + def _compute_is_low_stock_alert(self): + config_param = self.env['ir.config_parameter'].sudo() + is_low_stock_alert_individual = config_param.get_param( + 'low_stocks_product_alert.is_low_stock_alert_individual') + for product in self: + product.is_low_stock_alert = bool( + is_low_stock_alert_individual)