Add fix to support changes in user permission (#13923)
https://github.com/frappe/frappe/pull/5494
This commit is contained in:
parent
eec0209e3c
commit
dcc90e3312
@ -130,15 +130,15 @@ def get_default_price_list(party):
|
||||
|
||||
def set_price_list(out, party, party_type, given_price_list):
|
||||
# price list
|
||||
price_list = filter(None, get_user_permissions().get("Price List", []))
|
||||
if isinstance(price_list, list):
|
||||
price_list = price_list[0] if len(price_list)==1 else None
|
||||
price_list = filter(None, get_user_permissions()
|
||||
.get("Price List", {})
|
||||
.get("docs", []))
|
||||
price_list = list(price_list)
|
||||
|
||||
if not price_list:
|
||||
price_list = get_default_price_list(party)
|
||||
|
||||
if not price_list:
|
||||
price_list = given_price_list
|
||||
if price_list:
|
||||
price_list = price_list[0]
|
||||
else:
|
||||
price_list = get_default_price_list(party) or given_price_list
|
||||
|
||||
if price_list:
|
||||
out.price_list_currency = frappe.db.get_value("Price List", price_list, "currency")
|
||||
|
@ -39,7 +39,7 @@ def execute(filters=None):
|
||||
item_value.setdefault((item, item_map[item]["item_group"]),[])
|
||||
item_value[(item, item_map[item]["item_group"])].append(total_stock_value)
|
||||
|
||||
|
||||
|
||||
# sum bal_qty by item
|
||||
for (item, item_group), wh_balance in item_balance.items():
|
||||
total_stock_value = sum(item_value[(item, item_group)])
|
||||
@ -87,7 +87,9 @@ def validate_filters(filters):
|
||||
def get_warehouse_list(filters):
|
||||
from frappe.defaults import get_user_permissions
|
||||
condition = ''
|
||||
user_permitted_warehouse = filter(None, get_user_permissions().get("Warehouse", []))
|
||||
user_permitted_warehouse = filter(None, get_user_permissions()
|
||||
.get("Warehouse", {})
|
||||
.get("docs", []))
|
||||
value = ()
|
||||
if user_permitted_warehouse:
|
||||
condition = "and name in %s"
|
||||
@ -96,7 +98,7 @@ def get_warehouse_list(filters):
|
||||
condition = "and name = %s"
|
||||
value = filters.get("warehouse")
|
||||
|
||||
return frappe.db.sql("""select name
|
||||
return frappe.db.sql("""select name
|
||||
from `tabWarehouse` where is_group = 0
|
||||
{condition}""".format(condition=condition), value, as_dict=1)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user