From 54c2c087478036dc2edcfe8084f388217b179971 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 a6354749fbd..9ce29acd016 100644 --- a/addons/account/models/account_move.py +++ b/addons/account/models/account_move.py @@ -471,7 +471,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: