From e638d0098aa5cf495dd400bde82c5196539cc7b0 Mon Sep 17 00:00:00 2001
From: daniquilez <dani.quilez@gmail.com>
Date: Thu, 27 Feb 2025 11:54:51 +0100
Subject: [PATCH] =?UTF-8?q?[FIX]=20=F0=9F=90=9B=20Validate=20platform=20co?=
 =?UTF-8?q?mpany=20has=20payment=20mode=20defined?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../wizards/service_invoicing_action_create.py  | 17 +++++++----------
 1 file changed, 7 insertions(+), 10 deletions(-)

diff --git a/energy_communities_service_invoicing/wizards/service_invoicing_action_create.py b/energy_communities_service_invoicing/wizards/service_invoicing_action_create.py
index 0f99cc40d..f13cb08ca 100644
--- a/energy_communities_service_invoicing/wizards/service_invoicing_action_create.py
+++ b/energy_communities_service_invoicing/wizards/service_invoicing_action_create.py
@@ -191,13 +191,10 @@ class ServiceInvoicingActionCreateWizard(models.TransientModel):
                         record.name
                     )
                 )
-        # Check current company has configuration payment mode for multicompany creation
-        if (
-            self.community_company_mids
-            and not self.env.company.service_invoicing_payment_mode_id
-        ):
-            raise ValidationError(
-                _(
-                    "Platform {} must have a service invoicing payment mode defined"
-                ).format(self.env.company.name)
-            )
+            # Check current company has configuration payment mode for multicompany creation
+            if not self.env.company.service_invoicing_payment_mode_id:
+                raise ValidationError(
+                    _(
+                        "Platform {} must have a service invoicing payment mode defined"
+                    ).format(self.env.company.name)
+                )
-- 
GitLab