diff --git a/services/operation_services.py b/services/operation_services.py index 5dd7a46130b2e66901dff1381d49c444c7b3c988..2087061bf3bcf253a4aa02b935ca914c72cf579b 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,