From 75c803bbbda447e6357e7a4fefd9e8b39e81f971 Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Fri, 2 Jun 2017 15:58:08 +0200 Subject: [PATCH] [FIX] account: create taxes at reconciliation - Create an excluded tax of 20 % - Create a customer invoice of 1000 - Create a payment of 900 - Make the matching between the invoice and the payment: Write-off of 83.33, with the 20 % tax Error: 'Cannot create unbalanced journal entry' After commit 89cbef8540ab08af16b7, the tax are by default not created automatically anymore. We should make sure to pass the context key `apply_taxes`. opw-744266 --- 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 bae80439415..9351900c159 100644 --- a/addons/account/models/account_move.py +++ b/addons/account/models/account_move.py @@ -962,7 +962,7 @@ class AccountMoveLine(models.Model): second_line_dict['amount_currency'] = -second_line_dict['amount_currency'] # Create the move - writeoff_move = self.env['account.move'].create({ + writeoff_move = self.env['account.move'].with_context(apply_taxes=True).create({ 'journal_id': vals['journal_id'], 'date': vals['date'], 'state': 'draft',