From d8ab0edbb30b988e92c9cb627b71433153a34300 Mon Sep 17 00:00:00 2001
From: Hugo Trentesaux <hugo@le-filament.com>
Date: Wed, 14 May 2025 16:12:41 +0200
Subject: [PATCH] wip scoring

---
 models/financial_contract_guarantee.py | 22 +++++++++++++---------
 1 file changed, 13 insertions(+), 9 deletions(-)

diff --git a/models/financial_contract_guarantee.py b/models/financial_contract_guarantee.py
index 9b21245..dcab765 100644
--- a/models/financial_contract_guarantee.py
+++ b/models/financial_contract_guarantee.py
@@ -185,14 +185,20 @@ class FinancialContractGuarantee(models.Model):
     segment_code = fields.Char("Code Segment")
     bdf_scoring = fields.Char(
         string="Cotation BDF",
-        compute="_compute_guarantee_data",
-        store=True,
-        readonly=False,
-        tracking=2,
+        related="partner_id.bdf_scoring",
+    )
+    bdf_date = fields.Date(
+        string="Date Cotation BDF",
+        related="partner_id.bdf_date",
+    )
+    mcdo_scoring = fields.Char(
+        string="Cotation MacDonough",
+        related="partner_id.mcdo_scoring",
+    )
+    mcdo_date = fields.Date(
+        string="Date Cotation MacDonough",
+        related="partner_id.mcdo_date",
     )
-    bdf_date = fields.Char("Date Cotation BDF")
-    mcdo_scoring = fields.Char("Cotation MacDonough")
-    mcdo_date = fields.Date("Date Cotation MacDonough")
     branch_code = fields.Char("Code branche")
 
     # Invoice Data
@@ -223,7 +229,6 @@ class FinancialContractGuarantee(models.Model):
 
     @api.depends(
         "line_ids",
-        "line_ids.bdf_scoring",
         "line_ids.end_date",
         "line_ids.payment_date",
         "line_ids.loan_duration",
@@ -238,7 +243,6 @@ class FinancialContractGuarantee(models.Model):
                 last_line = ordered[0]
                 guarantee.update(
                     {
-                        "bdf_scoring": last_line.bdf_scoring,
                         "expiration_date_computed": last_line.end_date,
                         "payment_date_computed": last_line.payment_date,
                         "loan_duration_computed": last_line.loan_duration,
-- 
GitLab