[FIX] account_tax_cash_basis: zero line

- Create a new account of type "Expenses". Allow the reconciliation and
  assign this account on the internal category of a product on both
  "Expense account", "Stock Input" and "Stock Output".
- Create a fiscal position to get the following tax behavior: apply two
  taxes of the same amount but with opposite sign (+ 21% on the one
  side; - 21% on the other side). Activate the tax cash basis feature on
  these taxes. It should give, on the same FP:
  Tax 21% -> Tax 21%
  Tax 21% -> Tax -21%
- Create a journal for the tax cash basis, set it in the company
  settings.
- Create a PO (with the previously created FP) for several products
  belonging to the same internal category and receive the products. Each
  line generates an entry recorded in the stock journal. The expense
  account is used in those entries.
- Create the supplier invoice for the PO and validate which also
  generates a journal entry with as many line on the expense account as
  there are some products on the invoice.
- In the journal items, reconcile the expenses accounts entries
  generated by the stock input and the supplier invoice.

It triggers a lot of lines on this expense account for 0 each.

opw-726120
This commit is contained in:
Nicolas Martinelli
2017-04-11 09:00:38 +02:00
parent 91470a37fe
commit 1d29649e57
@@ -3,6 +3,7 @@
from odoo import api, models, _
from odoo.exceptions import UserError
from odoo.tools import float_is_zero
class AccountPartialReconcileCashBasis(models.Model):
@@ -24,7 +25,7 @@ class AccountPartialReconcileCashBasis(models.Model):
currency_id = line.currency_id or line.company_id.currency_id
matched_percentage = value_before_reconciliation[move.id]
amount = currency_id.round((line.credit_cash_basis - line.debit_cash_basis) - (line.credit - line.debit) * matched_percentage)
if not line.tax_exigible:
if not float_is_zero(amount, precision_rounding=currency_id.rounding) and not line.tax_exigible:
if line.tax_line_id and line.tax_line_id.use_cash_basis:
# group by line account
acc = line.account_id.id