diff --git a/erpnext/shopping_cart/cart.py b/erpnext/shopping_cart/cart.py index 963514eb7f..a51f6f3425 100644 --- a/erpnext/shopping_cart/cart.py +++ b/erpnext/shopping_cart/cart.py @@ -368,7 +368,8 @@ def get_debtors_account(cart_settings): return debtors_account_name -def get_address_docs(doctype=None, txt=None, filters=None, limit_start=0, limit_page_length=20, party=None): +def get_address_docs(doctype=None, txt=None, filters=None, limit_start=0, limit_page_length=20, + party=None): if not party: party = get_party() @@ -380,8 +381,8 @@ def get_address_docs(doctype=None, txt=None, filters=None, limit_start=0, limit_ out = [] - for address_name in address_names: - address = frappe.get_doc('Address', address_name) + for a in address_names: + address = frappe.get_doc('Address', a.parent) address.display = get_address_display(address.as_dict()) out.append(address) diff --git a/erpnext/shopping_cart/test_shopping_cart.py b/erpnext/shopping_cart/test_shopping_cart.py index 314e1a4ab2..f221a8a7a1 100644 --- a/erpnext/shopping_cart/test_shopping_cart.py +++ b/erpnext/shopping_cart/test_shopping_cart.py @@ -14,6 +14,7 @@ class TestShoppingCart(unittest.TestCase): """ def setUp(self): frappe.set_user("Administrator") + create_test_contact_and_address() self.enable_shopping_cart() def tearDown(self): @@ -185,7 +186,6 @@ class TestShoppingCart(unittest.TestCase): frappe.set_user("test_cart_user@example.com") def login_as_customer(self): - create_test_contact_and_address() self.create_user_if_not_exists("test_contact_customer@example.com", "_Test Contact For _Test Customer") frappe.set_user("test_contact_customer@example.com")