Skip to content

Commit

Permalink
fix: round off bundle qty
Browse files Browse the repository at this point in the history
This is to accomodate bundles that might allow floating point qty.
  • Loading branch information
ankush committed Apr 27, 2022
1 parent 25485ed commit 41aa4b3
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion erpnext/stock/doctype/pick_list/pick_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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):
Expand Down

0 comments on commit 41aa4b3

Please sign in to comment.