From 1b475753723c81f46414357dfd449a47fe342dff Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Thu, 6 Sep 2018 11:14:01 +0200 Subject: [PATCH] [FIX] account: cash basis in statement - Set up a 10 % tax with a 'Tax Due' as 'Based on Payment' - Create a bank statement of 110, Reconcile - Create a new AML for the reconciliation using the mentioned tax for an amount of 100 - Validate The tax amount does not appear in the Generic Tax Report. This is a specific case where the reconciliation process creates the payment itself. Therefore, the tax amount should appear in the report. To do so, we explicitly send the `tax_exigible` value on the AML, and propagate it to the tax line. opw-1858492 --- addons/account/models/account.py | 1 + addons/account/models/account_move.py | 2 ++ .../static/src/js/reconciliation/reconciliation_model.js | 2 ++ 3 files changed, 5 insertions(+) diff --git a/addons/account/models/account.py b/addons/account/models/account.py index 4642cacd9b5..0a274a89275 100644 --- a/addons/account/models/account.py +++ b/addons/account/models/account.py @@ -994,6 +994,7 @@ class AccountTax(models.Model): 'refund_account_id': tax.refund_account_id.id, 'analytic': tax.analytic, 'price_include': tax.price_include, + 'tax_exigibility': tax.tax_exigibility, }) return { diff --git a/addons/account/models/account_move.py b/addons/account/models/account_move.py index 67ec719a655..ca1dfbd98a2 100644 --- a/addons/account/models/account_move.py +++ b/addons/account/models/account_move.py @@ -1313,6 +1313,8 @@ class AccountMoveLine(models.Model): ctx['date'] = vals['date'] temp['currency_id'] = bank.currency_id.id temp['amount_currency'] = bank.company_id.currency_id.with_context(ctx).compute(tax_vals['amount'], bank.currency_id, round=True) + if vals.get('tax_exigible'): + temp['tax_exigible'] = True tax_lines_vals.append(temp) #Toggle the 'tax_exigible' field to False in case it is not yet given and the tax in 'tax_line_id' or one of diff --git a/addons/account/static/src/js/reconciliation/reconciliation_model.js b/addons/account/static/src/js/reconciliation/reconciliation_model.js index 538b8c83369..9748f6c63e3 100644 --- a/addons/account/static/src/js/reconciliation/reconciliation_model.js +++ b/addons/account/static/src/js/reconciliation/reconciliation_model.js @@ -819,6 +819,7 @@ var StatementModel = BasicModel.extend({ prop.computed_with_tax = tax.price_include prop.tax_amount = tax.amount + prop.tax_exigible = tax.tax_exigibility === 'on_payment' ? true : undefined prop.amount = tax.base; prop.amount_str = field_utils.format.monetary(Math.abs(prop.amount), {}, formatOptions); prop.invalid = !self._isValid(prop); @@ -1105,6 +1106,7 @@ var StatementModel = BasicModel.extend({ name : prop.label, debit : amount > 0 ? amount : 0, credit : amount < 0 ? -amount : 0, + tax_exigible: prop.tax_exigible, // This one isn't usefull for the server, // But since we need to change the amount (and thus its semantics) into base_amount // It might be useful to have a trace in the RPC for debugging purposes