Skip to content

Commit

Permalink
[RES] account_refund_early_payment: The split tax from price unit cal…
Browse files Browse the repository at this point in the history
…culation on the invoice line will only be done if the tax doesn't have set the option to be included in price, because odoo will do the calculation. (#1331)
  • Loading branch information
keylor2906 authored and Jose Antonio Morales Ponce [Vauxoo] committed Feb 6, 2019
1 parent f90bfbc commit 375963a
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions account_refund_early_payment/wizard/account_invoice_refund.py
Expand Up @@ -50,15 +50,18 @@ def compute_refund(self, mode):
break
percentage = inv.amount_total / total
taxes = self.product_id.taxes_id
tax_perc = sum(taxes.mapped('amount'))
tax_perc = sum(taxes.filtered(
lambda tax: not tax.price_include
and tax.amount_type == 'percent').mapped('amount'))
self.env['account.invoice.line'].create({
'invoice_id': refund.id,
'product_id': self.product_id.id,
'name': self.product_id.name_get()[0][1],
'uom_id': self.product_id.uom_id.id,
'invoice_line_tax_ids': [
(6, 0, taxes._ids)],
'price_unit': self.amount_total * percentage / (1.0 + abs(tax_perc) / 100),
'price_unit': self.amount_total * percentage / (
1.0 + (tax_perc or 0.0) / 100),
'account_id': self.product_id.property_account_income_id.id or
self.product_id.categ_id.property_account_income_categ_id.id
})
Expand Down

0 comments on commit 375963a

Please sign in to comment.