[FIX] account: do not set default account

Do not set a default `account_id` for section and note lines. Indeed,
when set the constraint `check_non_accountable_fields_null` will raise.

opw-2241575

closes odoo/odoo#50040

X-original-commit: 997a98d2d3d12caf554040922876164040de9efa
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
This commit is contained in:
Nicolas Martinelli
2020-04-23 08:26:11 +00:00
parent 9bcfb5c8d8
commit c22f99dd09
+2
View File
@@ -3740,6 +3740,8 @@ class AccountMoveLine(models.Model):
if 'account_id' in default_fields and not values.get('account_id'):
if len(move.line_ids[-2:]) == 2 and move.line_ids[-1].account_id == move.line_ids[-2].account_id != False:
values['account_id'] = move.line_ids[-2:].mapped('account_id').id
if values.get('display_type'):
values.pop('account_id', None)
return values
@api.depends('ref', 'move_id')