fix: Sort website products by weightage mentioned in Item master

This commit is contained in:
marination 2021-06-21 19:38:37 +05:30
parent 82adb4f16e
commit c212d7fafd

View File

@ -61,7 +61,8 @@ class ProductQuery:
],
or_filters=self.or_filters,
start=start,
limit=self.page_length
limit=self.page_length,
order_by="weightage desc"
)
items_dict = {item.name: item for item in items}
@ -71,7 +72,15 @@ class ProductQuery:
result = [items_dict.get(item) for item in list(set.intersection(*all_items))]
else:
result = frappe.get_all("Item", fields=self.fields, filters=self.filters, or_filters=self.or_filters, start=start, limit=self.page_length)
result = frappe.get_all(
"Item",
fields=self.fields,
filters=self.filters,
or_filters=self.or_filters,
start=start,
limit=self.page_length,
order_by="weightage desc"
)
for item in result:
product_info = get_product_info_for_website(item.item_code, skip_quotation_creation=True).get('product_info')