diff options
| author | Nicolas Seinlet <nse@odoo.com> | 2021-01-22 14:42:29 +0000 |
|---|---|---|
| committer | Nicolas Seinlet <nse@odoo.com> | 2021-01-22 16:15:39 +0000 |
| commit | d6f27d568377ba23d859fefe02a33b07c678b233 (patch) | |
| tree | d1d06b9ec8f6a307439cb9fec9e9b88851142c35 /addons | |
| parent | 0d0e1062e793e82f1513eeeacb8279ff67a03442 (diff) | |
[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#64954
X-original-commit: 677edafeaf8d691764178f5e7e9639017b0249a8
Signed-off-by: Quentin De Paoli (qdp) <qdp@openerp.com>
Diffstat (limited to 'addons')
| -rw-r--r-- | addons/account/models/account_move.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/addons/account/models/account_move.py b/addons/account/models/account_move.py index 059cf1d7ae8..286c010cf3d 100644 --- a/addons/account/models/account_move.py +++ b/addons/account/models/account_move.py @@ -4563,6 +4563,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 |
