mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-19 21:19:19 +00:00
Merge pull request #30162 from frappe/mergify/bp/version-13-hotfix/pr-30103
fix: Ignore missing customer group while fetching price list (backport #30103)
This commit is contained in:
@@ -152,7 +152,7 @@ def set_contact_details(party_details, party, party_type):
|
|||||||
|
|
||||||
def set_other_values(party_details, party, party_type):
|
def set_other_values(party_details, party, party_type):
|
||||||
# copy
|
# copy
|
||||||
if party_type=="Customer":
|
if party_type == "Customer":
|
||||||
to_copy = ["customer_name", "customer_group", "territory", "language"]
|
to_copy = ["customer_name", "customer_group", "territory", "language"]
|
||||||
else:
|
else:
|
||||||
to_copy = ["supplier_name", "supplier_group", "language"]
|
to_copy = ["supplier_name", "supplier_group", "language"]
|
||||||
@@ -171,12 +171,8 @@ def get_default_price_list(party):
|
|||||||
return party.default_price_list
|
return party.default_price_list
|
||||||
|
|
||||||
if party.doctype == "Customer":
|
if party.doctype == "Customer":
|
||||||
price_list = frappe.get_cached_value("Customer Group",
|
return frappe.db.get_value("Customer Group", party.customer_group, "default_price_list")
|
||||||
party.customer_group, "default_price_list")
|
|
||||||
if price_list:
|
|
||||||
return price_list
|
|
||||||
|
|
||||||
return None
|
|
||||||
|
|
||||||
def set_price_list(party_details, party, party_type, given_price_list, pos=None):
|
def set_price_list(party_details, party, party_type, given_price_list, pos=None):
|
||||||
# price list
|
# price list
|
||||||
|
|||||||
16
erpnext/accounts/test_party.py
Normal file
16
erpnext/accounts/test_party.py
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
import frappe
|
||||||
|
from frappe.tests.utils import FrappeTestCase
|
||||||
|
|
||||||
|
from erpnext.accounts.party import get_default_price_list
|
||||||
|
|
||||||
|
|
||||||
|
class PartyTestCase(FrappeTestCase):
|
||||||
|
def test_get_default_price_list_should_return_none_for_invalid_group(self):
|
||||||
|
customer = frappe.get_doc({
|
||||||
|
'doctype': 'Customer',
|
||||||
|
'customer_name': 'test customer',
|
||||||
|
}).insert(ignore_permissions=True, ignore_mandatory=True)
|
||||||
|
customer.customer_group = None
|
||||||
|
customer.save()
|
||||||
|
price_list = get_default_price_list(customer)
|
||||||
|
assert price_list is None
|
||||||
Reference in New Issue
Block a user