fix: Paging and Discount filter
- Convert incoming api args to frappe dict - Change discount filter condition due to reversal of behaviour
This commit is contained in:
parent
78b791cd1d
commit
942dedddb4
@ -27,6 +27,7 @@ def get_product_filter_data(query_args=None):
|
||||
if isinstance(query_args, str):
|
||||
query_args = json.loads(query_args)
|
||||
|
||||
query_args = frappe._dict(query_args)
|
||||
if query_args:
|
||||
search = query_args.get("search")
|
||||
field_filters = query_args.get("field_filters", {})
|
||||
|
@ -289,7 +289,7 @@ class ProductQuery:
|
||||
def filter_results_by_discount(self, fields, result):
|
||||
if fields and fields.get("discount"):
|
||||
discount_percent = frappe.utils.flt(fields["discount"][0])
|
||||
result = [row for row in result if row.get("discount_percent") and row.discount_percent >= discount_percent]
|
||||
result = [row for row in result if row.get("discount_percent") and row.discount_percent <= discount_percent]
|
||||
|
||||
if self.filter_with_discount:
|
||||
# no limit was added to results while querying
|
||||
|
Loading…
x
Reference in New Issue
Block a user