From 2d914b58a70dc96b61852e5891547f7d6bf32539 Mon Sep 17 00:00:00 2001
From: Juliana <juliana@le-filament.com>
Date: Wed, 9 Aug 2023 14:35:43 +0200
Subject: [PATCH] [FIX]Add check data field in all function

---
 services/operation_services.py | 31 +++++++++++++++----------------
 1 file changed, 15 insertions(+), 16 deletions(-)

diff --git a/services/operation_services.py b/services/operation_services.py
index 8c99f2e..80eded5 100644
--- a/services/operation_services.py
+++ b/services/operation_services.py
@@ -212,7 +212,6 @@ class OperationsService(Component):
 
         # Récupération de tous les contrats liés à l'opération spécifiée
         domain_c = [("acc_operation_id", "=", _id)]
-        domain_pmo = [("acc_operation_id", "=", _id)]
         role = self._get_role(operation)
         if role.get("isConsumer") or role.get("isProductor"):
             domain_c += [
@@ -220,22 +219,17 @@ class OperationsService(Component):
                 ("type", "=", "other"),
                 ("type", "=", "vente_achat"),
             ]
-        if role.get("isPmo"):
-            domain_pmo += [("type", "!=", False)]
-            acc_contract_ids = self.env["acc.contract"].sudo().search(domain_pmo)
-        else:
-            acc_contract_all = (
-                self.env["acc.contract"]
-                .sudo()
-                .search(
-                    [
-                        ("acc_operation_id", "=", _id),
-                        ("type", "=", "all"),
-                    ]
-                )
+
+        acc_contract_all = (
+            self.env["acc.contract"]
+            .sudo()
+            .search([
+                ("acc_operation_id", "=", _id),
+                ("type", "=", "all"),
+                ])
             )
-            acc_contract_ids = self.env["acc.contract"].search(domain_c)
-            acc_contract_ids += acc_contract_all
+        acc_contract_ids = self.env["acc.contract"].search(domain_c)
+        acc_contract_ids += acc_contract_all
 
         acc_contract_pmo = self.env["acc.contract"].search(
             [
@@ -739,6 +733,7 @@ class OperationsService(Component):
                     "isPmo": {"type": "boolean"},
                     "isConsumer": {"type": "boolean"},
                     "isProductor": {"type": "boolean"},
+                    "isDataCdc": {"type": "boolean"},
                 },
             },
             "id": {"type": "integer"},
@@ -763,6 +758,7 @@ class OperationsService(Component):
                     "isPmo": {"type": "boolean"},
                     "isConsumer": {"type": "boolean"},
                     "isProductor": {"type": "boolean"},
+                    "isDataCdc": {"type": "boolean"},
                 },
             },
             "id": {"type": "integer"},
@@ -854,6 +850,7 @@ class OperationsService(Component):
                     "isPmo": {"type": "boolean"},
                     "isConsumer": {"type": "boolean"},
                     "isProductor": {"type": "boolean"},
+                    "isDataCdc": {"type": "boolean"},
                 },
             },
             "graph_data": {
@@ -887,6 +884,7 @@ class OperationsService(Component):
                     "isPmo": {"type": "boolean"},
                     "isConsumer": {"type": "boolean"},
                     "isProductor": {"type": "boolean"},
+                    "isDataCdc": {"type": "boolean"},
                 },
             },
             "prms": {
@@ -944,6 +942,7 @@ class OperationsService(Component):
                     "isPmo": {"type": "boolean"},
                     "isConsumer": {"type": "boolean"},
                     "isProductor": {"type": "boolean"},
+                    "isDataCdc": {"type": "boolean"},
                 },
             },
             "prms": {
-- 
GitLab