Skip to content
Permalink
Browse files

[FIX] sale: compute taxes only once

Oversight of commit e6ff16c which
resulted in the computation of taxes for a single invoice twice.
  • Loading branch information...
Elkasitu committed Mar 20, 2019
1 parent 4dfe115 commit 7a754d5270f4938197e18cb262f935f3a5a2de82
Showing with 2 additions and 3 deletions.
  1. +2 −3 addons/sale/models/sale.py
@@ -571,6 +571,8 @@ def action_invoice_create(self, grouped=False, final=False):
raise UserError(_('There is no invoiceable line. If a product has a Delivered quantities invoicing policy, please make sure that a quantity has been delivered.'))

for invoice in invoices.values():
# Necessary to force computation of taxes. In account_invoice, they are triggered
# by onchanges, which are not triggered when doing a create.
invoice.compute_taxes()
if not invoice.invoice_line_ids:
raise UserError(_('There is no invoiceable line. If a product has a Delivered quantities invoicing policy, please make sure that a quantity has been delivered.'))
@@ -582,9 +584,6 @@ def action_invoice_create(self, grouped=False, final=False):
# Use additional field helper function (for account extensions)
for line in invoice.invoice_line_ids:
line._set_additional_fields(invoice)
# Necessary to force computation of taxes. In account_invoice, they are triggered
# by onchanges, which are not triggered when doing a create.
invoice.compute_taxes()
# Idem for partner
so_payment_term_id = invoice.payment_term_id.id
invoice._onchange_partner_id()

0 comments on commit 7a754d5

Please sign in to comment.
You can’t perform that action at this time.