From 1d8be6517f0cfe19555219e7e4d91bbf628b305e Mon Sep 17 00:00:00 2001 From: william-andre Date: Thu, 2 Feb 2023 10:23:21 +0000 Subject: [PATCH] [FIX] account: set payment sequence correctly MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Before the fix, the compute function is set as a string in the `default` parameter. Meaning that it will always be True because a non empty string is truthy. Fix by converting the field to be compute-editable, like the function was designed to be. closes odoo/odoo#114904 X-original-commit: 11121120b13fc7500ee720f10964de6b9a0373af Signed-off-by: Laurent Smet Signed-off-by: William André (wan) --- addons/account/models/account_journal.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/addons/account/models/account_journal.py b/addons/account/models/account_journal.py index f957c058673..e13ddfc5196 100644 --- a/addons/account/models/account_journal.py +++ b/addons/account/models/account_journal.py @@ -115,7 +115,11 @@ class AccountJournal(models.Model): country_code = fields.Char(related='company_id.account_fiscal_country_id.code', readonly=True) refund_sequence = fields.Boolean(string='Dedicated Credit Note Sequence', help="Check this box if you don't want to share the same sequence for invoices and credit notes made from this journal", default=False) - payment_sequence = fields.Boolean(string='Dedicated Payment Sequence', help="Check this box if you don't want to share the same sequence on payments and bank transactions posted on this journal", default='_compute_payment_sequence') + payment_sequence = fields.Boolean( + string='Dedicated Payment Sequence', + compute='_compute_payment_sequence', readonly=False, store=True, precompute=True, + help="Check this box if you don't want to share the same sequence on payments and bank transactions posted on this journal", + ) sequence_override_regex = fields.Text(help="Technical field used to enforce complex sequence composition that the system would normally misunderstand.\n"\ "This is a regex that can include all the following capture groups: prefix1, year, prefix2, month, prefix3, seq, suffix.\n"\ "The prefix* groups are the separators between the year, month and the actual increasing sequence number (seq).\n"\