From 3a318e7c4026779b2d2500aed948703318b20574 Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Fri, 17 Nov 2017 09:15:26 +0100 Subject: [PATCH] [FIX] account: initial balance - Create manually an account move - Add a line with a credit != 0 - Click on "Add a line" => crash `line_ids` does not contain the credit since it was not filled in. opw-782980 --- addons/account/models/account_move.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/account/models/account_move.py b/addons/account/models/account_move.py index 60300a0b0f1..da1a6b1b52d 100644 --- a/addons/account/models/account_move.py +++ b/addons/account/models/account_move.py @@ -447,7 +447,7 @@ class AccountMoveLine(models.Model): balance = 0 for line in self._context['line_ids']: if line[2]: - balance += line[2]['debit'] - line[2]['credit'] + balance += line[2].get('debit', 0) - line[2].get('credit', 0) if balance < 0: rec.update({'debit': -balance}) if balance > 0: