Skip to content
Snippets Groups Projects
Commit 3ce23eb4 authored by Damien Bouvy's avatar Damien Bouvy
Browse files

[FIX] sale: uom conversion for invoiced quantities

When invoicing products from a SO, you may decide to change the uom
of the invoice (if you invoiced only  a fraction of the product, for
example). In that case, conversion is necessary to ensure that the
"invoiced quantity" field on the SO line is correct.
parent 313bc91c
No related branches found
No related tags found
No related merge requests found
......@@ -529,9 +529,9 @@ class SaleOrderLine(models.Model):
for invoice_line in line.invoice_lines:
if invoice_line.invoice_id.state != 'cancel':
if invoice_line.invoice_id.type == 'out_invoice':
qty_invoiced += invoice_line.quantity
qty_invoiced += self.env['product.uom']._compute_qty_obj(invoice_line.uom_id, invoice_line.quantity, line.product_uom)
elif invoice_line.invoice_id.type == 'out_refund':
qty_invoiced -= invoice_line.quantity
qty_invoiced -= self.env['product.uom']._compute_qty_obj(invoice_line.uom_id, invoice_line.quantity, line.product_uom)
line.qty_invoiced = qty_invoiced
@api.depends('price_subtotal', 'product_uom_qty')
......
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