[FIX] account: set payment sequence correctly

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 <las@odoo.com>
Signed-off-by: William André (wan) <wan@odoo.com>
This commit is contained in:
william-andre
2023-03-10 12:31:14 +01:00
parent d8958a45ba
commit 1d8be6517f
+5 -1
View File
@@ -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"\