From 8fb16637e6fff80fde6ccb2f9ed28b39495ad8db Mon Sep 17 00:00:00 2001
From: Juliana <juliana@le-filament.com>
Date: Mon, 2 May 2022 19:42:47 +0200
Subject: [PATCH] [UPD]Restriction contract

---
 services/operation_services.py | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/services/operation_services.py b/services/operation_services.py
index e24b668..628b4c9 100644
--- a/services/operation_services.py
+++ b/services/operation_services.py
@@ -193,14 +193,17 @@ class OperationsService(Component):
         else:
             # Récupération de toutes les factures liées à l'opération spécifiée
             domain = [("acc_operation_id", "=", _id)]
+            domain_pmo = [("acc_operation_id", "=", _id)]
             role = self._get_role(operation)
             if role.get("isConsumer"):
                 domain += [("type", "=", "achat")]
             if role.get("isProductor"):
                 domain += [("type", "=", "vente")]
             if role.get("isPmo"):
-                domain += [("type", "!=", False)]
-            acc_contract_ids = self.env["acc.contract"].search(domain)
+                domain_pmo += [("type", "!=", False)]
+                acc_contract_ids = self.env["acc.contract"].search(domain_pmo)
+            else:
+                acc_contract_ids = self.env["acc.contract"].search(domain)
 
             datas["contracts"] = []
             for n in acc_contract_ids:
-- 
GitLab