mirror of
https://github.com/frappe/erpnext.git
synced 2026-08-23 20:16:40 +00:00
Co-authored-by: Mihir Kandoi <kandoimihir@gmail.com>
This commit is contained in:
@@ -211,16 +211,28 @@ def item_query(doctype, txt, searchfield, start, page_len, filters, as_dict=Fals
|
||||
|
||||
if filters and isinstance(filters, dict):
|
||||
if filters.get("customer") or filters.get("supplier"):
|
||||
party_type = "Customer" if filters.get("customer") else "Supplier"
|
||||
party = filters.get("customer") or filters.get("supplier")
|
||||
group = "Customer Group" if filters.get("customer") else "Supplier Group"
|
||||
item_rules_list = frappe.get_all(
|
||||
"Party Specific Item",
|
||||
filters={
|
||||
"party": ["!=", party],
|
||||
"party_type": "Customer" if filters.get("customer") else "Supplier",
|
||||
"party_type": party_type,
|
||||
},
|
||||
fields=["restrict_based_on", "based_on_value"],
|
||||
)
|
||||
|
||||
party_group_rules_list = frappe.get_all(
|
||||
"Party Specific Item",
|
||||
filters={"party_type": group},
|
||||
fields=["party as party_group", "restrict_based_on", "based_on_value"],
|
||||
)
|
||||
current_party_group = frappe.get_value(party_type, party, frappe.scrub(group))
|
||||
for rule in party_group_rules_list:
|
||||
if current_party_group != rule.party_group:
|
||||
item_rules_list.append(rule)
|
||||
|
||||
filters_dict = {}
|
||||
for rule in item_rules_list:
|
||||
if rule["restrict_based_on"] == "Item":
|
||||
|
||||
Reference in New Issue
Block a user