diff --git a/addons/stock/tests/test_stock_return_picking.py b/addons/stock/tests/test_stock_return_picking.py index 0947c1047c1..4213bb37fa9 100644 --- a/addons/stock/tests/test_stock_return_picking.py +++ b/addons/stock/tests/test_stock_return_picking.py @@ -178,8 +178,9 @@ class TestReturnPicking(TestStockCommon): def test_return_wizard_with_partial_delivery(self): """ - Create a picking for 10 units, deliver 6, and do not backorder the remaining 4. - Then, attempt to return the quantity that was delivered. The return should be created with the correct quantity. + Create a picking for 10 grams, deliver 0.01, and do not backorder the remaining quantity. + Then, attempt to return the quantity that was delivered. The quantity should be properly verified + to not be equal to 0 and the return should be created. """ delivery_picking = self.PickingObj.create({ 'picking_type_id': self.picking_type_out, @@ -188,14 +189,14 @@ class TestReturnPicking(TestStockCommon): }) out_move = self.MoveObj.create({ 'name': "OUT move", - 'product_id':self.productA.id, + 'product_id': self.gB.id, 'product_uom_qty': 10, 'picking_id': delivery_picking.id, 'location_id': self.stock_location, 'location_dest_id': self.customer_location, }) delivery_picking.action_confirm() - out_move.quantity = 6 + out_move.quantity = 0.01 # No backorder res_dict = delivery_picking.with_context(picking_ids_not_to_backorder=delivery_picking.id).button_validate() @@ -206,4 +207,4 @@ class TestReturnPicking(TestStockCommon): .with_context(active_ids=delivery_picking.ids, active_id=delivery_picking.ids[0], active_model='stock.picking')) stock_return_picking = stock_return_picking_form.save() - self.assertEqual(stock_return_picking.product_return_moves.quantity, 6) + self.assertEqual(stock_return_picking.product_return_moves.quantity, 0.01) diff --git a/addons/stock/wizard/stock_picking_return.py b/addons/stock/wizard/stock_picking_return.py index 2309c28c761..0fe0067b497 100644 --- a/addons/stock/wizard/stock_picking_return.py +++ b/addons/stock/wizard/stock_picking_return.py @@ -142,7 +142,7 @@ class ReturnPicking(models.TransientModel): for return_line in self.product_return_moves: if not return_line.move_id: raise UserError(_("You have manually created product lines, please delete them to proceed.")) - if not float_is_zero(return_line.quantity, return_line.uom_id.rounding): + if not float_is_zero(return_line.quantity, precision_rounding=return_line.uom_id.rounding): returned_lines += 1 vals = self._prepare_move_default_values(return_line, new_picking) r = return_line.move_id.copy(vals)