diff --git a/checklog-odoo.cfg b/checklog-odoo.cfg index af88836..0b55b7b 100644 --- a/checklog-odoo.cfg +++ b/checklog-odoo.cfg @@ -1,7 +1,3 @@ [checklog-odoo] ignore= -<<<<<<< before updating - WARNING.* 0 failed, 0 error\(s\).* -======= WARNING.* 0 failed, 0 error\(s\).* ->>>>>>> after updating diff --git a/intrastat_base/models/product_template.py b/intrastat_base/models/product_template.py index 3229f99..a097919 100644 --- a/intrastat_base/models/product_template.py +++ b/intrastat_base/models/product_template.py @@ -16,9 +16,14 @@ class ProductTemplate(models.Model): ], compute="_compute_intrastat_type", store=True, + precompute=True, help="Type of product used for the intrastat declarations.", ) is_accessory_cost = fields.Boolean( + compute="_compute_is_accessory_cost", + store=True, + precompute=True, + readonly=False, help="Activate this option for shipping costs, packaging " "costs and all services related to the sale of products. " "This option is used for Intrastat reports.", @@ -38,6 +43,12 @@ class ProductTemplate(models.Model): break this.intrastat_type = intrastat_type + @api.depends("intrastat_type") + def _compute_is_accessory_cost(self): + for this in self: + if this.intrastat_type != "service": + this.is_accessory_cost = False + @api.constrains("intrastat_type", "is_accessory_cost") def _check_accessory_cost(self): for this in self: