diff --git a/delivery_hibou/models/delivery.py b/delivery_hibou/models/delivery.py index c604c02a..96c9c68b 100644 --- a/delivery_hibou/models/delivery.py +++ b/delivery_hibou/models/delivery.py @@ -318,7 +318,7 @@ class ChooseDeliveryPackage(models.TransientModel): and not ml.result_package_id ) if not move_line_ids: - move_line_ids = picking_move_lines.filtered(lambda ml: float_compare(ml.product_uom_qty, 0.0, + move_line_ids = picking_move_lines.filtered(lambda ml: float_compare(ml.reserved_uom_qty, 0.0, precision_rounding=ml.product_uom_id.rounding) > 0 and float_compare( ml.qty_done, 0.0, precision_rounding=ml.product_uom_id.rounding) == 0) diff --git a/delivery_hibou/models/stock.py b/delivery_hibou/models/stock.py index 050a7f03..c3083aec 100644 --- a/delivery_hibou/models/stock.py +++ b/delivery_hibou/models/stock.py @@ -84,7 +84,7 @@ class StockPicking(models.Model): cost = sum([(l.product_id.standard_price * l.qty_done) for l in self.move_line_ids] or [0.0]) if not cost: # Assume Full Value - cost = sum([(l.product_id.standard_price * l.product_uom_qty) for l in self.move_lines] or [0.0]) + cost = sum([(l.product_id.standard_price * l.product_uom_qty) for l in self.move_ids] or [0.0]) return cost def clear_carrier_tracking_ref(self): diff --git a/delivery_hibou/tests/test_delivery_hibou.py b/delivery_hibou/tests/test_delivery_hibou.py index 1dd9aa99..42bf6074 100644 --- a/delivery_hibou/tests/test_delivery_hibou.py +++ b/delivery_hibou/tests/test_delivery_hibou.py @@ -88,7 +88,7 @@ class TestDeliveryHibou(common.TransactionCase): # This relies heavily on the 'stock' demo data. # Should only have a single move_line_ids and it should not be done at all. self.assertEqual(picking_out.move_line_ids.mapped('qty_done'), [0.0]) - self.assertEqual(picking_out.move_line_ids.mapped('product_uom_qty'), [15.0]) + self.assertEqual(picking_out.move_line_ids.mapped('reserved_uom_qty'), [15.0]) self.assertEqual(picking_out.move_line_ids.mapped('product_id.standard_price'), [100.0]) test_whole_value = 15.0 * 100.0 test_one_value = 100.0 @@ -138,7 +138,7 @@ class TestDeliveryHibou(common.TransactionCase): # This relies heavily on the 'stock' demo data. # Should only have a single move_line_ids and it should not be done at all. self.assertEqual(picking_in.move_line_ids.mapped('qty_done'), [0.0]) - self.assertEqual(picking_in.move_line_ids.mapped('product_uom_qty'), [35.0]) + self.assertEqual(picking_in.move_line_ids.mapped('reserved_uom_qty'), [35.0]) self.assertEqual(picking_in.move_line_ids.mapped('product_id.standard_price'), [55.0]) self.assertEqual(picking_in.carrier_id._classify_picking(picking=picking_in), 'in')