From 60125450d9839279bcdeb62bc830b5c686bdbcae Mon Sep 17 00:00:00 2001
From: Emanuel Buzey <buzeyemanuel@gmail.com>
Date: Thu, 19 Oct 2023 15:55:35 +0200
Subject: [PATCH] [FIX] energy_selfconsumption: save contract_template_id data

---
 energy_selfconsumption/wizards/define_invoicing_mode_wizard.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/energy_selfconsumption/wizards/define_invoicing_mode_wizard.py b/energy_selfconsumption/wizards/define_invoicing_mode_wizard.py
index 6bcdcedae..93bbe2a1a 100644
--- a/energy_selfconsumption/wizards/define_invoicing_mode_wizard.py
+++ b/energy_selfconsumption/wizards/define_invoicing_mode_wizard.py
@@ -160,11 +160,12 @@ result = line.supply_point_assignation_id.distribution_table_id.selfconsumption_
             self._prepare_contract_values(journal_id, contract_line)
         )
 
+        product_id.write({"contract_template_id": contract_template_id.id})
+
         self.selfconsumption_id.write(
             {
                 "invoicing_mode": self.invoicing_mode,
                 "product_id": product_id,
-                "contract_template_id": contract_template_id,
             }
         )
 
-- 
GitLab