[FIX] purchase_requisition_stock: calculate on-time rate when percentage is zero
Versions: --------- - 16.0 Steps to reproduce: ------------------- - Create a new Purchase Order. - Set the Vendor to a brand new contact. - Add a product that would be delivered. - Confirm the PO, set the Expected delivery date in the past. - Notice that on_time_rate and on_time_rate_perc are both -1. - Process the delivery. - Now on_time_rate is 0 but on_time_rate_perc is -1 still! Issue: ------ The field OTD is -1 even when On-time delivery is 0 Cause: ------ The issue is happening because if po.on_time_rate == 0 the value Is set to -1. Solution: --------- Modify the condition to ‘po.on_time_rate >= 0’ to handle this case OPW-3413668 closes odoo/odoo#128584 X-original-commit: 4e3bf2242808435fd13be323af535cc6cc816da3 Signed-off-by: Adrien Widart (awt) <awt@odoo.com> Signed-off-by: Matheus Leal Viana (malv) <malv@odoo.com>
This commit is contained in:
@@ -12,7 +12,7 @@ class PurchaseOrder(models.Model):
|
||||
@api.depends('on_time_rate')
|
||||
def _compute_on_time_rate_perc(self):
|
||||
for po in self:
|
||||
if po.on_time_rate > 0:
|
||||
if po.on_time_rate >= 0:
|
||||
po.on_time_rate_perc = po.on_time_rate / 100
|
||||
else:
|
||||
po.on_time_rate_perc = -1
|
||||
|
||||
Reference in New Issue
Block a user