diff --git a/product_contract/models/sale_order.py b/product_contract/models/sale_order.py index 57467736c..98b4b948d 100644 --- a/product_contract/models/sale_order.py +++ b/product_contract/models/sale_order.py @@ -83,6 +83,7 @@ class SaleOrder(models.Model): 'sale_order_line_id' ) ) + contract_templates = self.env["contract.template"] for order_line in line_to_create_contract: contract_template = order_line.product_id.with_context( force_company=rec.company_id.id @@ -95,6 +96,8 @@ class SaleOrder(models.Model): rec.company_id.name ) ) + contract_templates |= contract_template + for contract_template in contract_templates: order_lines = line_to_create_contract.filtered( lambda r, template=contract_template: r.product_id.with_context(