From 9aacdc89d3bea90df43029f8f4f561da52b9fb0a Mon Sep 17 00:00:00 2001 From: Carlos Dauden Date: Thu, 13 Jun 2019 18:36:28 +0200 Subject: [PATCH] [FIX] stock_picking_report_valued: division_by_zero when unrelated sale order --- stock_picking_report_valued/__manifest__.py | 2 +- stock_picking_report_valued/models/stock_move_line.py | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/stock_picking_report_valued/__manifest__.py b/stock_picking_report_valued/__manifest__.py index 9f64b9c..deacb9b 100644 --- a/stock_picking_report_valued/__manifest__.py +++ b/stock_picking_report_valued/__manifest__.py @@ -8,7 +8,7 @@ { "name": "Valued Picking Report", "summary": "Adding Valued Picking on Delivery Slip report", - "version": "11.0.1.0.2", + "version": "11.0.1.0.3", "author": "Tecnativa, " "Odoo Community Association (OCA)", "website": "https://www.tecnativa.com", diff --git a/stock_picking_report_valued/models/stock_move_line.py b/stock_picking_report_valued/models/stock_move_line.py index 64d4ba0..5d28d9b 100644 --- a/stock_picking_report_valued/models/stock_move_line.py +++ b/stock_picking_report_valued/models/stock_move_line.py @@ -63,9 +63,11 @@ class StockMoveLine(models.Model): records...). """ for line in self: + price_unit = ( + line.sale_line.price_subtotal / line.sale_line.product_uom_qty + if line.sale_line.product_uom_qty else 0.0) taxes = line.sale_tax_id.compute_all( - price_unit=line.sale_line.price_subtotal / ( - line.sale_line.product_uom_qty or 0.0), + price_unit=price_unit, currency=line.currency_id, quantity=line.qty_done or line.product_qty, product=line.product_id,