From 4f9fc188d398f45280ddbf9c61ecfad1ea476e92 Mon Sep 17 00:00:00 2001 From: Jorge Pinna Puissant Date: Tue, 29 Jan 2019 12:34:48 +0000 Subject: [PATCH] [FIX] stock: Warning in picking on product with serial number In stock.picking, in mode show detailed operation, add a product with unique serial number tracking. Before this commit, a warning about the qty is raised. This warning, must be raised only if the qty is different from 1. However this is not the case, the warning is raised at each modification of the line. This issue occurs since the rounding given to the float_compare is 0.0, because self.move_id.product_id is not set. Float_compare with a 0.0 rounding always return different, hence the bug. Now, the warning is only raised when the qty is different from 1. OPW-1932044 OPW-1931378 closes odoo/odoo#30651 closes odoo/odoo#30851 --- addons/stock/models/stock_move_line.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/stock/models/stock_move_line.py b/addons/stock/models/stock_move_line.py index 6fe34e6bc96..870de679a38 100644 --- a/addons/stock/models/stock_move_line.py +++ b/addons/stock/models/stock_move_line.py @@ -141,7 +141,7 @@ class StockMoveLine(models.Model): """ res = {} if self.qty_done and self.product_id.tracking == 'serial': - if float_compare(self.qty_done, 1.0, precision_rounding=self.move_id.product_id.uom_id.rounding) != 0: + if float_compare(self.qty_done, 1.0, precision_rounding=self.product_id.uom_id.rounding) != 0: message = _('You can only process 1.0 %s for products with unique serial number.') % self.product_id.uom_id.name res['warning'] = {'title': _('Warning'), 'message': message} return res