From 8b17bcefb4eae428a4a50cd31ef68d927d7cdd76 Mon Sep 17 00:00:00 2001
From: Juliana <juliana@le-filament.com>
Date: Wed, 17 May 2023 17:22:42 +0200
Subject: [PATCH] [ADD]Add info invoice Conso

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

diff --git a/services/operation_services.py b/services/operation_services.py
index 1485c1e..9e72a95 100644
--- a/services/operation_services.py
+++ b/services/operation_services.py
@@ -249,7 +249,7 @@ class OperationsService(Component):
         if type == "invoice" and invoice_exist:
 
             datas["documents"] = (
-                acc_account_ids.mapped(
+                acc_account_ids.sudo().mapped(
                     lambda n: {
                         "id": n.id,
                         "name": n.name,
@@ -257,6 +257,8 @@ class OperationsService(Component):
                         "start_date": n.start_date,
                         "end_date": n.end_date,
                         "amount_total": n.amount_total,
+                        "consumer": n.consumer_id.name,
+                        "prm_c": n.acc_delivery_id.name,
                         "url": base_url + n.get_portal_url(report_type="pdf"),
                     }
                 )
@@ -265,13 +267,14 @@ class OperationsService(Component):
             )
 
             datas["factures_externes"] = (
-                acc_contract_ids_f.mapped(
+                acc_contract_ids_f.sudo().mapped(
                     lambda n: {
                         "id": n.id,
                         "name": n.name,
                         "start_date": n.start_date,
                         "end_date": n.end_date,
                         "type": n.type,
+                        "seller": n.seller_id.name,
                         "url": base_url + n.get_portal_url(),
                     }
                 )
@@ -776,6 +779,8 @@ class OperationsService(Component):
                         "end_date": {"type": "date", "nullable": True},
                         "amount_total": {"type": "float", "nullable": True},
                         "url": {"type": "string", "nullable": True},
+                        "consumer": {"type": "string", "nullable": True},
+                        "prm_c": {"type": "string", "nullable": True},
                     },
                 },
             },
-- 
GitLab