2
0

[FIX] account_move_name_sequence: redefine _onchange_journal_id

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'
This commit is contained in:
mde-spring 2023-10-26 10:45:53 +02:00
parent cda322ce6f
commit 80c5077c22
No known key found for this signature in database
GPG Key ID: 1913BFB41EB17436

View File

@ -77,3 +77,9 @@ class AccountMove(models.Model):
def _get_last_sequence(self, relaxed=False, with_prefix=None, lock=True):
return super()._get_last_sequence(relaxed, None, lock)
@api.onchange("journal_id")
def _onchange_journal_id(self):
if not self.quick_edit_mode:
self.name = "/"
self._compute_name_by_sequence()