[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
This commit is contained in:
committed by
Nicolas Martinelli
parent
e0b14bf9a7
commit
4f9fc188d3
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user