[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
This commit is contained in:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user