diff --git a/account_factoring_receivable_balance/__manifest__.py b/account_factoring_receivable_balance/__manifest__.py
index 1530bc3..a4add3a 100644
--- a/account_factoring_receivable_balance/__manifest__.py
+++ b/account_factoring_receivable_balance/__manifest__.py
@@ -22,6 +22,7 @@
"views/subrogation_receipt.xml",
"views/partner.xml",
"views/account_move.xml",
+ "views/account_move_line.xml",
"data/action.xml",
],
"demo": [],
diff --git a/account_factoring_receivable_balance/views/account_move_line.xml b/account_factoring_receivable_balance/views/account_move_line.xml
new file mode 100644
index 0000000..9f941de
--- /dev/null
+++ b/account_factoring_receivable_balance/views/account_move_line.xml
@@ -0,0 +1,54 @@
+
+
+
+
+ account.move.line
+
+
+
+
+
+
+
+
+
+ account.move.line
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/account_factoring_receivable_balance_eurofactor/__manifest__.py b/account_factoring_receivable_balance_eurofactor/__manifest__.py
index 0ac0e88..5d5f84f 100644
--- a/account_factoring_receivable_balance_eurofactor/__manifest__.py
+++ b/account_factoring_receivable_balance_eurofactor/__manifest__.py
@@ -18,6 +18,7 @@
"data": [
"views/partner.xml",
"views/account_journal.xml",
+ "views/account_move_line.xml",
"views/subrogation.xml",
"data/data.xml",
"report/subrogation.xml",
diff --git a/account_factoring_receivable_balance_eurofactor/models/account_move.py b/account_factoring_receivable_balance_eurofactor/models/account_move.py
index 61e38a0..19220fc 100644
--- a/account_factoring_receivable_balance_eurofactor/models/account_move.py
+++ b/account_factoring_receivable_balance_eurofactor/models/account_move.py
@@ -1,7 +1,7 @@
# © 2024 David BEAL @ Akretion
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
-from odoo import models
+from odoo import fields, models
class AccountMove(models.Model):
@@ -19,6 +19,8 @@ def _display_eurofactor_bank(self):
class AccountMoveLine(models.Model):
_inherit = "account.move.line"
+ eurofactor_ref = fields.Char(related="partner_id.eurofactor_ref", string="Eurof")
+
def _eurof_fields_rpt(self):
partner = self.partner_id.commercial_partner_id
ref = partner._get_partner_eurof_mapping().get(partner, "")
diff --git a/account_factoring_receivable_balance_eurofactor/models/partner.py b/account_factoring_receivable_balance_eurofactor/models/partner.py
index b0a63eb..ac60392 100644
--- a/account_factoring_receivable_balance_eurofactor/models/partner.py
+++ b/account_factoring_receivable_balance_eurofactor/models/partner.py
@@ -1,7 +1,7 @@
# © 2024 David BEAL @ Akretion
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
-from odoo import fields, models
+from odoo import api, fields, models
MODULE = __name__[12 : __name__.index(".", 13)]
@@ -14,6 +14,7 @@ class ResPartner(models.Model):
company_dependent=True,
groups="account.group_account_manager",
)
+ eurofactor_ref = fields.Char()
def _get_partner_eurof_mapping(self):
rec_categ = self.env.ref(f"{MODULE}.eurofactor_id_category")
@@ -42,3 +43,27 @@ def printit(records):
"n'ont pas de compte bancaire d'identifiant d'affacturage."
)
return message
+
+
+class ResPartnerId_number(models.Model):
+ _inherit = "res.partner.id_number"
+
+ dummy = fields.Boolean(compute="_compute_dummy", store=True)
+
+ @api.depends("partner_id", "category_id", "name")
+ def _compute_dummy(self):
+ for rec in self:
+ if (
+ rec.partner_id
+ and rec.env.ref(f"{MODULE}.eurofactor_id_category") == rec.category_id
+ ):
+ rec.partner_id.eurofactor_ref = rec.name
+ else:
+ rec.partner_id.eurofactor_ref = False
+
+ def unlink(self):
+ res = super().unlink()
+ for rec in self:
+ if rec.partner_id:
+ rec.partner_id.eurofactor_ref = False
+ return res
diff --git a/account_factoring_receivable_balance_eurofactor/views/account_move_line.xml b/account_factoring_receivable_balance_eurofactor/views/account_move_line.xml
new file mode 100644
index 0000000..6494e9b
--- /dev/null
+++ b/account_factoring_receivable_balance_eurofactor/views/account_move_line.xml
@@ -0,0 +1,32 @@
+
+
+
+
+ account.move.line
+
+
+
+
+
+
+
+
+
+ account.move.line
+
+
+
+
+
+
+
+
+
+
diff --git a/account_factoring_receivable_balance_eurofactor/views/partner.xml b/account_factoring_receivable_balance_eurofactor/views/partner.xml
index 63f07c4..bae6f8f 100644
--- a/account_factoring_receivable_balance_eurofactor/views/partner.xml
+++ b/account_factoring_receivable_balance_eurofactor/views/partner.xml
@@ -34,6 +34,11 @@
string="Eurofactor Id"
name="id_numbers"
domain="[('id_numbers', '!=', False)]"
+ />
+