From 954cabc77bd4e7be4dc74e4ef9dd7fd3432353cf Mon Sep 17 00:00:00 2001 From: daniquilez <dani.quilez@gmail.com> Date: Tue, 25 Feb 2025 11:40:21 +0100 Subject: [PATCH] =?UTF-8?q?[IMP]=20=E2=9C=A8=20Propagate=20sale=20descript?= =?UTF-8?q?ion=20from=20product=20to=20contract=20template=20line?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../models/product_template.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/energy_communities_service_invoicing/models/product_template.py b/energy_communities_service_invoicing/models/product_template.py index 662106d75..d9b8d3eef 100644 --- a/energy_communities_service_invoicing/models/product_template.py +++ b/energy_communities_service_invoicing/models/product_template.py @@ -30,3 +30,16 @@ class ProductTemplate(models.Model): ctemplates = self.env["contract.template"].search([]) for ctemplate in ctemplates: ctemplate.compute_is_pack() + + @api.constrains("description_sale") + def compute_contract_template_line_name(self): + for record in self: + ctemplatelines = self.env["contract.template.line"].search( + [("product_id", "=", record.product_variant_id.id)] + ) + for ctemplateline in ctemplatelines: + ctemplateline.write( + { + "name": ctemplateline.product_id.get_product_multiline_description_sale() + } + ) -- GitLab