From 9668a148d919da994e804c94b75d453c1b0fbabb Mon Sep 17 00:00:00 2001
From: daniquilez <dani.quilez@gmail.com>
Date: Wed, 12 Mar 2025 11:43:00 +0100
Subject: [PATCH] =?UTF-8?q?[IMP]=20=E2=9C=A8=20Propagate=20lin=20name=20fr?=
 =?UTF-8?q?om=20origin=20to=20inter=20company=20invoice?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../models/account_move.py                        | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/energy_communities_service_invoicing/models/account_move.py b/energy_communities_service_invoicing/models/account_move.py
index 17adda591..8f59f28e7 100644
--- a/energy_communities_service_invoicing/models/account_move.py
+++ b/energy_communities_service_invoicing/models/account_move.py
@@ -51,7 +51,8 @@ class AccountMove(models.Model):
     def custom_compute_pack_type(self):
         self._set_custom_pack_type_on_invoice()
 
-    # define configuration intercompany journal
+    # Inter Company:
+    # define configuration journal
     def _prepare_invoice_data(self, dest_company):
         inv_data = super()._prepare_invoice_data(dest_company)
         if (
@@ -62,3 +63,15 @@ class AccountMove(models.Model):
                 "journal_id"
             ] = dest_company.sudo().service_invoicing_purchase_journal_id.id
         return inv_data
+
+
+class AccountMoveLine(models.Model):
+    _inherit = "account.move.line"
+
+    # Inter Company:
+    # propagate name from origin invoice
+    @api.model
+    def _prepare_account_move_line(self, dest_move, dest_company):
+        vals = super()._prepare_account_move_line(dest_move, dest_company)
+        vals["name"] = self.name
+        return vals
-- 
GitLab