From 2833db559e3ada9e977765cec6c872c764180430 Mon Sep 17 00:00:00 2001 From: Faris Ansari Date: Tue, 14 Apr 2020 11:50:54 +0530 Subject: [PATCH] fix: Set Price List in case of User Permissions (#21238) Frontport of #18968 --- erpnext/accounts/party.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/erpnext/accounts/party.py b/erpnext/accounts/party.py index 156f2181b87..3d9ff273ce2 100644 --- a/erpnext/accounts/party.py +++ b/erpnext/accounts/party.py @@ -163,8 +163,9 @@ def get_default_price_list(party): def set_price_list(party_details, party, party_type, given_price_list, pos=None): # price list price_list = get_permitted_documents('Price List') - - if price_list: + + # if there is only one permitted document based on user permissions, set it + if price_list and len(price_list) == 1: price_list = price_list[0] elif pos and party_type == 'Customer': customer_price_list = frappe.get_value('Customer', party.name, 'default_price_list')