From 51cf14744f5f36c9a8461ab25c624bf3cf3c6a4d Mon Sep 17 00:00:00 2001
From: benjamin <benjamin@le-filament.com>
Date: Mon, 23 May 2022 11:47:58 +0200
Subject: [PATCH] [fix] error if no contract or invoice

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

diff --git a/services/operation_services.py b/services/operation_services.py
index 089c862..86c3e7c 100644
--- a/services/operation_services.py
+++ b/services/operation_services.py
@@ -190,7 +190,7 @@ class OperationsService(Component):
                     "amount_total": n.amount_total,
                     "url": base_url + n.get_portal_url(report_type="pdf"),
                 }
-            )
+            ) if acc_account_ids else []
         else:
             # Récupération de toutes les factures liées à l'opération spécifiée
             domain = [("acc_operation_id", "=", _id)]
@@ -214,7 +214,7 @@ class OperationsService(Component):
                 "type": n.type,
                 "url": base_url + n.get_portal_url(),
                 }
-            )
+            ) if acc_contract_ids else []
         return datas
 
     @restapi.method(
-- 
GitLab