diff --git a/addons/sale_purchase_stock/tests/test_unwanted_replenish_flow.py b/addons/sale_purchase_stock/tests/test_unwanted_replenish_flow.py index 95c8d668f74..17bbac58048 100644 --- a/addons/sale_purchase_stock/tests/test_unwanted_replenish_flow.py +++ b/addons/sale_purchase_stock/tests/test_unwanted_replenish_flow.py @@ -64,14 +64,14 @@ class TestWarnUnwantedReplenish(common.TransactionCase): orderpoint_form = Form(cls.env['stock.warehouse.orderpoint']) orderpoint_form.product_id = cls.product_A orderpoint_form.product_min_qty = 0.0 - orderpoint_form.product_max_qty = 1.0 + orderpoint_form.product_max_qty = 0.0 cls.orderpoint_A = orderpoint_form.save() cls.orderpoint_A.trigger = 'manual' orderpoint_form = Form(cls.env['stock.warehouse.orderpoint']) orderpoint_form.product_id = cls.product_B orderpoint_form.product_min_qty = 0.0 - orderpoint_form.product_max_qty = 1.0 + orderpoint_form.product_max_qty = 0.0 cls.orderpoint_B = orderpoint_form.save() cls.orderpoint_B.trigger = 'manual' diff --git a/addons/stock/models/stock_orderpoint.py b/addons/stock/models/stock_orderpoint.py index 6ea867efccf..dcc2ff8402a 100644 --- a/addons/stock/models/stock_orderpoint.py +++ b/addons/stock/models/stock_orderpoint.py @@ -174,7 +174,7 @@ class StockWarehouseOrderpoint(models.Model): @api.depends('product_id', 'qty_to_order', 'product_max_qty') def _compute_unwanted_replenish(self): for orderpoint in self: - if not orderpoint.product_id or float_is_zero(orderpoint.qty_to_order, precision_rounding=orderpoint.product_uom.rounding) or float_is_zero(orderpoint.product_max_qty, precision_rounding=orderpoint.product_uom.rounding): + if not orderpoint.product_id or float_is_zero(orderpoint.qty_to_order, precision_rounding=orderpoint.product_uom.rounding) or float_compare(orderpoint.product_max_qty, 0, precision_rounding=orderpoint.product_uom.rounding) == -1: orderpoint.unwanted_replenish = False else: after_replenish_qty = orderpoint.product_id.with_context(company_id=orderpoint.company_id.id, location=orderpoint.location_id.id).virtual_available + orderpoint.qty_to_order