diff --git a/erpnext/accounts/doctype/pricing_rule/pricing_rule.py b/erpnext/accounts/doctype/pricing_rule/pricing_rule.py index ac0cd7e895c..7f0f60ff02e 100644 --- a/erpnext/accounts/doctype/pricing_rule/pricing_rule.py +++ b/erpnext/accounts/doctype/pricing_rule/pricing_rule.py @@ -167,7 +167,12 @@ def get_pricing_rule_for_item(args): if args.transaction_type=="selling": if args.customer and not (args.customer_group and args.territory): - customer = frappe.get_cached_value("Customer", args.customer, ["customer_group", "territory"]) + + if args.quotation_to and args.quotation_to != 'Customer': + customer = frappe._dict() + else: + customer = frappe.get_cached_value("Customer", args.customer, ["customer_group", "territory"]) + if customer: args.customer_group, args.territory = customer diff --git a/erpnext/public/js/controllers/transaction.js b/erpnext/public/js/controllers/transaction.js index 8c74f736eab..623b6e7d216 100644 --- a/erpnext/public/js/controllers/transaction.js +++ b/erpnext/public/js/controllers/transaction.js @@ -429,6 +429,7 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({ set_warehouse: me.frm.doc.set_warehouse, warehouse: item.warehouse, customer: me.frm.doc.customer || me.frm.doc.party_name, + quotation_to: me.frm.doc.quotation_to, supplier: me.frm.doc.supplier, currency: me.frm.doc.currency, update_stock: update_stock, diff --git a/erpnext/stock/get_item_details.py b/erpnext/stock/get_item_details.py index 1c614dffab9..f9a4a151a4b 100644 --- a/erpnext/stock/get_item_details.py +++ b/erpnext/stock/get_item_details.py @@ -573,6 +573,10 @@ def validate_conversion_rate(args, meta): def get_party_item_code(args, item_doc, out): if args.transaction_type=="selling" and args.customer: out.customer_item_code = None + + if args.quotation_to != 'Customer': + return + customer_item_code = item_doc.get("customer_items", {"customer_name": args.customer}) if customer_item_code: