[FIX] stock: Warning on replenish max Qty change
Change the rules for the activation of the unwanted replenish warning.
Before :
Verification for unwanted replenish were only done if the
stock_orderpoint have a max qty >= 1
After :
Verification for unwanted replenish are done if the
stock_orderpoint have a max qty >= 0
task : 2918947
closes odoo/odoo#121144
Signed-off-by: Arnold Moyaux (arm) <arm@odoo.com>
This commit is contained in:
@@ -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'
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user