Skip to content
Snippets Groups Projects
Commit 1d1debf6 authored by Denis Ledoux's avatar Denis Ledoux
Browse files

[FIX] purchase: exclude cancelled invoice for billed qty

The billed quantity field on the purchase order line
must exclude the cancelled invoice, as a cancelled invoice
is not considered as invoiced.

`draft` could be considered as well, but we do not
take the chance now, as this field is used
when creating a new invoice, to determine the
quantity to invoice. Therefore, if there are
draft invoices with some quantities invoiced,
it can make sense to reduce the quantity
in this new invoice. Nevertheless, it must not be the case
for cancelled invoices.

opw-679363
parent fc8d96d2
No related branches found
No related tags found
No related merge requests found
......@@ -455,7 +455,8 @@ class PurchaseOrderLine(models.Model):
for line in self:
qty = 0.0
for inv_line in line.invoice_lines:
qty += inv_line.uom_id._compute_qty_obj(inv_line.uom_id, inv_line.quantity, line.product_uom)
if inv_line.invoice_id.state not in ['cancel']:
qty += inv_line.uom_id._compute_qty_obj(inv_line.uom_id, inv_line.quantity, line.product_uom)
line.qty_invoiced = qty
@api.depends('order_id.state', 'move_ids.state')
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment