[FIX] stock: use float_compare
Use proper `float_compare` method when comparing floats. opw-1958608 closes odoo/odoo#34370 Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
This commit is contained in:
@@ -392,10 +392,12 @@ class StockMove(models.Model):
|
||||
receipt_moves_to_reassign = self.env['stock.move']
|
||||
if 'product_uom_qty' in vals:
|
||||
for move in self.filtered(lambda m: m.state not in ('done', 'draft') and m.picking_id):
|
||||
if vals['product_uom_qty'] != move.product_uom_qty:
|
||||
if float_compare(vals['product_uom_qty'], move.product_uom_qty, precision_rounding=move.product_uom.rounding):
|
||||
self.env['stock.move.line']._log_message(move.picking_id, move, 'stock.track_move_template', vals)
|
||||
if self.env.context.get('do_not_unreserve') is None:
|
||||
move_to_unreserve = self.filtered(lambda m: m.state not in ['draft', 'done', 'cancel'] and m.reserved_availability > vals.get('product_uom_qty'))
|
||||
move_to_unreserve = self.filtered(
|
||||
lambda m: m.state not in ['draft', 'done', 'cancel'] and float_compare(m.reserved_availability, vals.get('product_uom_qty'), precision_rounding=m.product_uom.rounding) == 1
|
||||
)
|
||||
move_to_unreserve._do_unreserve()
|
||||
(self - move_to_unreserve).filtered(lambda m: m.state == 'assigned').write({'state': 'partially_available'})
|
||||
# When editing the initial demand, directly run again action assign on receipt moves.
|
||||
|
||||
Reference in New Issue
Block a user