In v16, _onchange_journal_id is defined to update name when journal_id is modified
During the creation of new account.move, this onchange is triggered and called the standard _compute_name method
How to reproduce issue:
* Create new invoice
=> Name is defined instead of to be 'Draft'
The core compute function for the name is calling at the end the function self._inverse_name(),
which updates the payment_reference when required.
This code was currently missing, causing the payment_reference not being properly computed,
for example, when using QR-Bills.
In case you want name your invoice YYYY-MM-SEQ (ie: 2022-07-00001)
where:
* YYYY: is the account move year
* MM: is the account move month
* SEQ: is a numerical sequence that is continue along the fiscal year
assuming fiscal year is over two years (ie: from july to june next year)
Before this commit the sequence prefix use now() to be compute but the
range is selected with the account move date.
This commit make consistency computing prefix with the account
move date as well.
So account move manage the first janunary for the last day of
the previous year will properly use the account move date.
Co-authored-by: Alexis de Lattre <alexis.delattre@akretion.com>
After remove required=True for journal.sequence_id field it is possible to post an invoice with misconfigured journal with empty sequence
So, this constraint will raise an error for this kind of cases since that using '/' could raise the unique constraint for all other moves