Merge pull request #11506 from saurabh6790/test_patches

[travis] run patches by restoring v7 database
diff --git a/erpnext/patches/v9_1/create_issue_opportunity_type.py b/erpnext/patches/v9_1/create_issue_opportunity_type.py
index 5b3819b..aa8bbd1 100644
--- a/erpnext/patches/v9_1/create_issue_opportunity_type.py
+++ b/erpnext/patches/v9_1/create_issue_opportunity_type.py
@@ -7,8 +7,8 @@
 
 def execute():
 	# delete custom field if exists
-	for fieldname in ('issue_type', 'opportunity_type'):
-		custom_field = frappe.db.get_value("Custom Field", {"fieldname": fieldname})
+	for doctype, fieldname in (('Issue', 'issue_type'), ('Opportunity', 'opportunity_type')):
+		custom_field = frappe.db.get_value("Custom Field", {"fieldname": fieldname, 'dt': doctype})
 		if custom_field:
 			frappe.delete_doc("Custom Field", custom_field, ignore_permissions=True)
 
diff --git a/erpnext/public/js/controllers/transaction.js b/erpnext/public/js/controllers/transaction.js
index f530137..621e9a7 100644
--- a/erpnext/public/js/controllers/transaction.js
+++ b/erpnext/public/js/controllers/transaction.js
@@ -1149,7 +1149,7 @@
 			}
 			if (item.warehouse) filters["warehouse"] = item.warehouse;
 
-			return s
+			return {
 				query : "erpnext.controllers.queries.get_batch_no",
 				filters: filters
 			}
diff --git a/erpnext/selling/page/point_of_sale/point_of_sale.js b/erpnext/selling/page/point_of_sale/point_of_sale.js
index c127e97..c7732f6 100644
--- a/erpnext/selling/page/point_of_sale/point_of_sale.js
+++ b/erpnext/selling/page/point_of_sale/point_of_sale.js
@@ -55,7 +55,7 @@
 			() => {
 				frappe.timeout(1);
 				this.make_items();
-				this.bind_events();
+				this.set_pos_profile_data();
 				frappe.dom.unfreeze();
 			},
 			() => this.page.set_title(__('Point of Sale'))
@@ -275,13 +275,30 @@
 
 					this.toggle_editing();
 					this.set_form_action();
+					this.set_primary_action_in_modal();
 				}
 			});
 		});
 	}
 
-	bind_events() {
+	set_primary_action_in_modal() {
+		this.frm.msgbox = frappe.msgprint(
+			`<a class="btn btn-primary" onclick="cur_frm.print_preview.printit(true)" style="margin-right: 5px;">
+				${__('Print')}</a>
+			<a class="btn btn-default">
+				${__('New')}</a>`
+		);
 
+		$(this.frm.msgbox.body).find('.btn-default').on('click', () => {
+			this.frm.msgbox.hide();
+			this.make_new_invoice();
+		})
+	}
+
+	set_pos_profile_data() {
+		if (this.pos_profile && this.pos_profile.print_format_for_online) {
+			this.frm.meta.default_print_format = this.pos_profile.print_format_for_online;
+		}
 	}
 
 	setup_pos_profile() {
@@ -370,6 +387,7 @@
 				if (this.cart) {
 					this.cart.frm = this.frm;
 					this.cart.reset();
+					this.items.reset_search_field();
 				} else {
 					this.make_cart();
 				}
@@ -434,9 +452,6 @@
 		if(this.frm.doc.docstatus !== 1) return;
 
 		this.page.set_secondary_action(__("Print"), () => {
-			if (this.pos_profile && this.pos_profile.print_format_for_online) {
-				this.frm.meta.default_print_format = this.pos_profile.print_format_for_online;
-			}
 			this.frm.print_preview.printit(true);
 		});
 
diff --git a/erpnext/setup/setup_wizard/test_setup_wizard.py b/erpnext/setup/setup_wizard/test_setup_wizard.py
index 313039b..5e2a303 100644
--- a/erpnext/setup/setup_wizard/test_setup_wizard.py
+++ b/erpnext/setup/setup_wizard/test_setup_wizard.py
@@ -30,16 +30,17 @@
 	time.sleep(1)
 	driver.click(".next-btn")
 
-	# # Profile slide
-	# driver.set_field("full_name", "Great Tester")
-	# driver.set_field("email", "great@example.com")
-	# driver.set_field("password", "test")
-	# driver.wait_for_ajax(True)
-	# time.sleep(1)
-	# driver.click(".next-btn")
-	# time.sleep(1)
+	# Profile slide
+	driver.set_field("full_name", "Great Tester")
+	driver.set_field("email", "great@example.com")
+	driver.set_field("password", "test")
+	driver.wait_for_ajax(True)
+	time.sleep(1)
+	driver.click(".next-btn")
+	time.sleep(1)
 
 	# domain slide
+	# time.sleep(3)
 	driver.set_select("domain", "Manufacturing")
 	time.sleep(1)
 	driver.click(".next-btn")
diff --git a/erpnext/shopping_cart/cart.py b/erpnext/shopping_cart/cart.py
index 7bc7874..f7a7d48 100644
--- a/erpnext/shopping_cart/cart.py
+++ b/erpnext/shopping_cart/cart.py
@@ -34,12 +34,15 @@
 
 	addresses = get_address_docs(party=party)
 
+	if not doc.customer_address and addresses:
+		update_cart_address("customer_address", addresses[0].name)
+
 	return {
 		"doc": decorate_quotation_doc(doc),
 		"shipping_addresses": [{"name": address.name, "display": address.display}
-			for address in addresses if address.address_type == "Shipping"],
+			for address in addresses],
 		"billing_addresses": [{"name": address.name, "display": address.display}
-			for address in addresses if address.address_type == "Billing"],
+			for address in addresses],
 		"shipping_rules": get_applicable_shipping_rules(party)
 	}
 
@@ -47,9 +50,8 @@
 def place_order():
 	quotation = _get_cart_quotation()
 	quotation.company = frappe.db.get_value("Shopping Cart Settings", None, "company")
-	for fieldname in ["customer_address", "shipping_address_name"]:
-		if not quotation.get(fieldname):
-			throw(_("{0} is required").format(quotation.meta.get_label(fieldname)))
+	if not quotation.get("customer_address"):
+		throw(_("{0} is required").format(_(quotation.meta.get_label("customer_address"))))
 
 	quotation.flags.ignore_permissions = True
 	quotation.submit()
diff --git a/erpnext/tests/ui/tests.txt b/erpnext/tests/ui/tests.txt
index 3e40485..35facc6 100644
--- a/erpnext/tests/ui/tests.txt
+++ b/erpnext/tests/ui/tests.txt
@@ -1,7 +1,7 @@
 erpnext/tests/ui/make_fixtures.js #long
 erpnext/setup/doctype/company/tests/test_company.js
-erpnext/accounts/doctype/account/test_account.js
-erpnext/accounts/doctype/account/test_make_tax_account.js
+erpnext/accounts/doctype/account/tests/test_account.js
+erpnext/accounts/doctype/account/tests/test_make_tax_account.js
 erpnext/accounts/doctype/pricing_rule/test_pricing_rule.js
 erpnext/accounts/doctype/sales_taxes_and_charges_template/test_sales_taxes_and_charges_template.js
 erpnext/accounts/doctype/purchase_taxes_and_charges_template/test_purchase_taxes_and_charges_template.js