From 44caba86d548d0fd4579ed9cfa98b6a09052bd40 Mon Sep 17 00:00:00 2001 From: Juliana <juliana@le-filament.com> Date: Thu, 16 Jun 2022 15:49:00 +0200 Subject: [PATCH] [UPD]Error on rule contract + invoice --- services/operation_services.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/services/operation_services.py b/services/operation_services.py index 5dd7a46..2087061 100644 --- a/services/operation_services.py +++ b/services/operation_services.py @@ -195,7 +195,7 @@ class OperationsService(Component): } if type == "invoice": # Récupération de toutes les factures liées à l'opération spécifiée - acc_account_ids = self.env["acc.account"].sudo().search( + acc_account_ids = self.env["acc.account"].search( [("acc_operation_id", "=", _id), ("state", "=", "published")] ) datas["documents"] = acc_account_ids.mapped(lambda n: @@ -214,15 +214,15 @@ class OperationsService(Component): 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("isConsumer") or role.get("isProductor"): + domain += [("type", "=", "vente_achat")] + # if role.get("isProductor"): + # domain += [("type", "=", "vente")] if role.get("isPmo"): domain_pmo += [("type", "!=", False)] acc_contract_ids = self.env["acc.contract"].sudo().search(domain_pmo) else: - acc_contract_ids = self.env["acc.contract"].sudo().search(domain) + acc_contract_ids = self.env["acc.contract"].search(domain) datas["contracts"] = acc_contract_ids.mapped(lambda n: { "id": n.id, -- GitLab