diff --git a/account_factoring_receivable_balance/models/account_move.py b/account_factoring_receivable_balance/models/account_move.py index 6a31893..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): @@ -21,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 81f3fae..f07c546 100644 --- a/account_factoring_receivable_balance/views/account_move.xml +++ b/account_factoring_receivable_balance/views/account_move.xml @@ -24,6 +24,16 @@ + + account.move + + + + + + + + account.invoice.filter account.move