fix: Prevent unit conversion in production schedule view state when use_all_schedules is true for replenishment calculations.
This commit is contained in:
parent
ebef032f0e
commit
3b19d279ff
@ -9,6 +9,12 @@ class MrpProductionSchedule(models.Model):
|
|||||||
def get_production_schedule_view_state(self, period_scale=False, use_all_schedules=False):
|
def get_production_schedule_view_state(self, period_scale=False, use_all_schedules=False):
|
||||||
res = super().get_production_schedule_view_state(period_scale, use_all_schedules)
|
res = super().get_production_schedule_view_state(period_scale, use_all_schedules)
|
||||||
for state in res:
|
for state in res:
|
||||||
|
# When use_all_schedules is True, it means we are in the context of replenishment calculation
|
||||||
|
# (action_replenish -> get_production_schedule_view_state), so we should NOT convert units
|
||||||
|
# because the system expects base units for procurement.
|
||||||
|
if use_all_schedules:
|
||||||
|
continue
|
||||||
|
|
||||||
mps = self.browse(state['id'])
|
mps = self.browse(state['id'])
|
||||||
if mps.packaging_id:
|
if mps.packaging_id:
|
||||||
packaging_qty = mps.packaging_id.qty
|
packaging_qty = mps.packaging_id.qty
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user