Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[16.0][IMP] ddmrp: reduce noise with auto-procure enabled #439

Merged
merged 1 commit into from May 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 11 additions & 0 deletions ddmrp/models/stock_buffer.py
Expand Up @@ -1781,6 +1781,7 @@ def write(self, vals):
def _procure_qty_to_order(self):
qty_to_order = self.procure_recommended_qty
rounding = self.procure_uom_id.rounding or self.product_uom.rounding
qty_in_progress = self._quantity_in_progress()[self._origin.id]
if (
self.item_type == "distributed"
and self.buffer_profile_id.replenish_distributed_limit_to_free_qty
Expand All @@ -1801,6 +1802,16 @@ def _procure_qty_to_order(self):
else:
# move only what we have in stock
return min(qty_to_order, self.distributed_source_location_qty)
elif (
float_compare(qty_in_progress, 0, precision_rounding=rounding) > 0
and float_compare(
qty_to_order, self.green_zone_qty, precision_rounding=rounding
)
< 0
):
# When there is qty in progress (e.g. RfQ sent), do not keep
# auto-procuring small quantities, wait for the qty to be at least GZ.
return 0
return qty_to_order

def do_auto_procure(self):
Expand Down