[FIX] account: restricted fields on notes
In 13.0, some account.move.line fields (amount_currency, debit, credit and account_id) couldn't have a value when the line is of type 'note'. Skiping them during line copy for notes is not an issue. During 12.0->13.0 migration, we were facing issues with "grouped similar invoice lines in a single move line", because this feature is not available anymore in 13.0. To avoid any "loss of data" during migration, we used lines of type note to create "missing" invoice lines in move lines without altering accounting in any way. As a consequence, we have 13.0 databases with lines of type note having values for fields who couldn't have ones. closes odoo/odoo#64962 X-original-commit: 677edafeaf8d691764178f5e7e9639017b0249a8 Signed-off-by: Quentin De Paoli (qdp) <qdp@openerp.com>
This commit is contained in:
@@ -4604,6 +4604,12 @@ class AccountMoveLine(models.Model):
|
||||
# Don't copy the name of a payment term line.
|
||||
if line.move_id.is_invoice() and line.account_id.user_type_id.type in ('receivable', 'payable'):
|
||||
values['name'] = ''
|
||||
# Don't copy restricted fields of notes
|
||||
if line.display_type in ('line_section', 'line_note'):
|
||||
values['amount_currency'] = 0
|
||||
values['debit'] = 0
|
||||
values['credit'] = 0
|
||||
values['account_id'] = False
|
||||
if self._context.get('include_business_fields'):
|
||||
line._copy_data_extend_business_fields(values)
|
||||
return res
|
||||
|
||||
Reference in New Issue
Block a user