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

perf: Duplicate queries for UOM (backport #35744) #35745

Merged
merged 1 commit into from
Jun 16, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions erpnext/stock/doctype/pick_list/pick_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def before_save(self):
for location in self.get("locations"):
if (
location.sales_order
and frappe.db.get_value("Sales Order", location.sales_order, "per_picked") == 100
and frappe.db.get_value("Sales Order", location.sales_order, "per_picked", cache=True) == 100
):
frappe.throw(
_("Row #{}: item {} has been picked already.").format(location.idx, location.item_code)
Expand Down Expand Up @@ -474,7 +474,7 @@ def get_items_with_location_and_quantity(item_doc, item_location_map, docstatus)
)
qty = stock_qty / (item_doc.conversion_factor or 1)

uom_must_be_whole_number = frappe.db.get_value("UOM", item_doc.uom, "must_be_whole_number")
uom_must_be_whole_number = frappe.get_cached_value("UOM", item_doc.uom, "must_be_whole_number")
if uom_must_be_whole_number:
qty = floor(qty)
stock_qty = qty * item_doc.conversion_factor
Expand Down