[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
This commit is contained in:
Nicolas Martinelli
2018-09-11 10:30:45 +02:00
committed by Nicolas Martinelli
parent 097963624f
commit 1b47575372
3 changed files with 5 additions and 0 deletions
+1
View File
@@ -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 {
+2
View File
@@ -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
@@ -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