diff --git a/energy_communities_service_invoicing/models/product_template.py b/energy_communities_service_invoicing/models/product_template.py index 662106d752aad2d6a69efd19038e88807b42e017..d9b8d3eef8ce36d88190d89b39d784754b88d0c5 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() + } + )