account-invoicing
account-invoicing copied to clipboard
[13.0][14.0] account_invoice_fixed_discount wrong tax
Hi,
I discovered a problem when creating invoices out of a sales order with a fixed discount. The tax amount on the created invoice doesn't get calculated correctly. This behavior occurs when also using the module sale-workflow/sale_fixed_discount.
Reproduce:
- Create a sales order with: Product with €390 unit price, €100 discount = €290 line total. Tax with 19% results in €55.10
- Confirm the sales order and create a regular invoice by clicking the "Create Invoice" Button in the sales order
- Invoice results in €390 unit price, €100 discount, €290 net total but tax 19% results in €74.10 (€390 * 0.19) so the fixed discount is disregarded.
I fixed the behavior by adding the following code to account.move but I don't know if its the best way.
@api.model
def create(self, vals):
res = super(SaleOrder, self).create(vals)
res.with_context(check_move_validity=False)._recompute_tax_lines()
res.with_context(check_move_validity=False)._onchange_invoice_line_ids()
return res
Hi, thanks for this report. We also experiencing the same issue in V14.0 when coming from sale order or any module where discount_fixed is set programmatically. Could you update the name of your issue by adding 14.0 to match with this case. I'll try your patch