summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGoffin Simon <sig@odoo.com>2016-12-06 20:23:25 +0100
committerGoffin Simon <sig@odoo.com>2016-12-07 08:43:11 +0100
commit0f63b2cce0f024ddfc5a3d3b1a31c91e20c16039 (patch)
tree045dc4ae652eb4122a7f7dc310cee52ac9163d6a
parent799f12c326e4f4a36e072ed0ccb8451e1b78fcda (diff)
[FIX] account_tax_cash_basis: function round on res.currency model
If there is no currency_id set on a account.move.line L, making L.currency_id.round(5) will always be equal to 0. opw:694660
-rw-r--r--addons/account_tax_cash_basis/tax_cash_basis.py11
1 files changed, 6 insertions, 5 deletions
diff --git a/addons/account_tax_cash_basis/tax_cash_basis.py b/addons/account_tax_cash_basis/tax_cash_basis.py
index 242356f4967..30877b0e3bf 100644
--- a/addons/account_tax_cash_basis/tax_cash_basis.py
+++ b/addons/account_tax_cash_basis/tax_cash_basis.py
@@ -52,8 +52,9 @@ class AccountPartialReconcileCashBasis(models.Model):
#TOCHECK: normal and cash basis taxes shoudn't be mixed together (on the same invoice line for example) as it will
#create reporting issues. Not sure of the behavior to implement in that case, though.
# amount to write is the current cash_basis amount minus the one before the reconciliation
+ currency_id = line.currency_id or line.company_id.currency_id
matched_percentage = value_before_reconciliation[move.id]
- amount = line.currency_id.round((line.credit_cash_basis - line.debit_cash_basis) - (line.credit - line.debit) * matched_percentage)
+ amount = currency_id.round((line.credit_cash_basis - line.debit_cash_basis) - (line.credit - line.debit) * matched_percentage)
if not self._check_tax_exigible(line):
if line.tax_line_id and line.tax_line_id.use_cash_basis:
# group by line account
@@ -73,15 +74,15 @@ class AccountPartialReconcileCashBasis(models.Model):
for tax in line.tax_ids:
line_to_create.append((0, 0, {
'name': '/',
- 'debit': line.currency_id.round(line.debit_cash_basis - line.debit * matched_percentage),
- 'credit': line.currency_id.round(line.credit_cash_basis - line.credit * matched_percentage),
+ 'debit': currency_id.round(line.debit_cash_basis - line.debit * matched_percentage),
+ 'credit': currency_id.round(line.credit_cash_basis - line.credit * matched_percentage),
'account_id': line.account_id.id,
'tax_ids': [(6, 0, [tax.id])],
}))
line_to_create.append((0, 0, {
'name': '/',
- 'credit': line.currency_id.round(line.debit_cash_basis - line.debit * matched_percentage),
- 'debit': line.currency_id.round(line.credit_cash_basis - line.credit * matched_percentage),
+ 'credit': currency_id.round(line.debit_cash_basis - line.debit * matched_percentage),
+ 'debit': currency_id.round(line.credit_cash_basis - line.credit * matched_percentage),
'account_id': line.account_id.id,
}))