diff --git a/account_factoring_receivable_balance/i18n/fr.po b/account_factoring_receivable_balance/i18n/fr.po
index dd2b474..0582251 100644
--- a/account_factoring_receivable_balance/i18n/fr.po
+++ b/account_factoring_receivable_balance/i18n/fr.po
@@ -644,6 +644,11 @@ msgstr "Montant non taxé"
msgid "Use Factor"
msgstr "Utiliser le factor"
+#. module: account_factoring_receivable_balance
+#: model_terms:ir.ui.view,arch_db:account_factoring_receivable_balance.view_account_invoice_filter
+msgid "Use factor"
+msgstr "Utiliser le factor"
+
#. module: account_factoring_receivable_balance
#: model:ir.model.fields,help:account_factoring_receivable_balance.field_res_company__factor_config_currency_id
msgid "Use to configure account and journal"
diff --git a/account_factoring_receivable_balance/models/account_move.py b/account_factoring_receivable_balance/models/account_move.py
index 6424868..3074221 100644
--- a/account_factoring_receivable_balance/models/account_move.py
+++ b/account_factoring_receivable_balance/models/account_move.py
@@ -1,7 +1,7 @@
# © 2023 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
class AccountMove(models.Model):
@@ -13,6 +13,7 @@ class AccountMove(models.Model):
use_factor = fields.Boolean(
compute="_compute_use_factor",
help="Depending on partner factor settings and skip factor field",
+ store=True,
)
factor_journal_id = fields.Many2one(
comodel_name="account.journal",
@@ -20,14 +21,18 @@ class AccountMove(models.Model):
store=False,
)
+ @api.depends(
+ "factor_journal_id",
+ "factor_journal_id.factor_start_date",
+ "factor_journal_id.factor_invoice_journal_ids",
+ )
def _compute_use_factor(self):
for rec in self:
use_factor = False
rec = rec.with_company(rec.company_id.id)
- factor_journal = rec.commercial_partner_id.factor_journal_id
- if factor_journal:
+ if rec.factor_journal_id:
# TODO replace by adhoc odoo method : domain to python expression
- domain = factor_journal._get_domain_for_factor()
+ domain = rec.factor_journal_id._get_domain_for_factor()
domain.extend([("id", "=", rec.id), ("skip_factor", "=", False)])
if rec.search(domain):
use_factor = True
diff --git a/account_factoring_receivable_balance/views/account_move.xml b/account_factoring_receivable_balance/views/account_move.xml
index 39c3bbe..f07c546 100644
--- a/account_factoring_receivable_balance/views/account_move.xml
+++ b/account_factoring_receivable_balance/views/account_move.xml
@@ -24,4 +24,30 @@
+
+ account.move
+
+
+
+
+
+
+
+
+
+ account.invoice.filter
+ account.move
+
+
+
+
+
+
+
+
+