From 41aa4b352407190c4f2ed6bc223cb4510555206c Mon Sep 17 00:00:00 2001 From: Ankush Menat Date: Mon, 25 Apr 2022 17:16:44 +0530 Subject: [PATCH] fix: round off bundle qty This is to accomodate bundles that might allow floating point qty. --- erpnext/stock/doctype/pick_list/pick_list.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/erpnext/stock/doctype/pick_list/pick_list.py b/erpnext/stock/doctype/pick_list/pick_list.py index 60f5e34efbba..aa015755fe35 100644 --- a/erpnext/stock/doctype/pick_list/pick_list.py +++ b/erpnext/stock/doctype/pick_list/pick_list.py @@ -261,6 +261,8 @@ def _get_product_bundle_qty_map(self, bundles: List[str]) -> Dict[str, Dict[str, def _compute_picked_qty_for_bundle(self, bundle_row, bundle_items) -> float: """Compute how many full bundles can be created from picked items.""" + precision = frappe.get_precision("Stock Ledger Entry", "qty_after_transaction") + possible_bundles = [] for item in self.locations: if item.product_bundle_item != bundle_row: @@ -270,7 +272,7 @@ def _compute_picked_qty_for_bundle(self, bundle_row, bundle_items) -> float: possible_bundles.append(item.picked_qty / qty_in_bundle) else: possible_bundles.append(0) - return min(possible_bundles) + return flt(min(possible_bundles), precision or 6) def validate_item_locations(pick_list):