From 3b19d279ffab8fa7582951ec25a670a327c7badf Mon Sep 17 00:00:00 2001 From: Suherdy Yacob Date: Wed, 18 Feb 2026 14:29:55 +0700 Subject: [PATCH] fix: Prevent unit conversion in production schedule view state when `use_all_schedules` is true for replenishment calculations. --- models/mrp_production_schedule.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/models/mrp_production_schedule.py b/models/mrp_production_schedule.py index 841b0bc..03427ba 100644 --- a/models/mrp_production_schedule.py +++ b/models/mrp_production_schedule.py @@ -9,6 +9,12 @@ class MrpProductionSchedule(models.Model): 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) 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']) if mps.packaging_id: packaging_qty = mps.packaging_id.qty