Merge pull request #26134 from marination/product-weightage

fix: Sort website products by weightage mentioned in Item master
This commit is contained in:
Marica 2021-06-22 11:16:20 +05:30 committed by GitHub
commit 9f15ebe711
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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')