Fixed merge conflict
diff --git a/erpnext/accounts/doctype/budget/budget.json b/erpnext/accounts/doctype/budget/budget.json
index ef8db86..a803b65 100644
--- a/erpnext/accounts/doctype/budget/budget.json
+++ b/erpnext/accounts/doctype/budget/budget.json
@@ -735,7 +735,7 @@
    "read_only": 0, 
    "remember_last_selected_value": 0, 
    "report_hide": 0, 
-   "reqd": 0, 
+   "reqd": 1,
    "search_index": 0, 
    "set_only_once": 0, 
    "translatable": 0, 
@@ -752,7 +752,7 @@
  "issingle": 0, 
  "istable": 0, 
  "max_attachments": 0, 
- "modified": "2018-06-15 17:09:01.430292", 
+ "modified": "2018-09-12 11:02:41.825923",
  "modified_by": "Administrator", 
  "module": "Accounts", 
  "name": "Budget", 
@@ -785,6 +785,7 @@
  "show_name_in_global_search": 0, 
  "sort_field": "modified", 
  "sort_order": "DESC", 
- "track_changes": 0, 
- "track_seen": 0
+ "track_changes": 1,
+ "track_seen": 0,
+ "track_views": 0
 }
\ No newline at end of file
diff --git a/erpnext/accounts/doctype/budget/budget.py b/erpnext/accounts/doctype/budget/budget.py
index b02126f..c83249b 100644
--- a/erpnext/accounts/doctype/budget/budget.py
+++ b/erpnext/accounts/doctype/budget/budget.py
@@ -36,7 +36,7 @@
 				b.name, ba.account from `tabBudget` b, `tabBudget Account` ba
 			where
 				ba.parent = b.name and b.docstatus < 2 and b.company = %s and %s=%s and
-				b.fiscal_year=%s and b.name != %sand ba.account in (%s) """
+				b.fiscal_year=%s and b.name != %s and ba.account in (%s) """
 				% ('%s', budget_against_field, '%s', '%s', '%s', ','.join(['%s'] * len(accounts))),
 			(self.company, budget_against, self.fiscal_year, self.name) + tuple(accounts), as_dict=1)
 
diff --git a/erpnext/accounts/doctype/pos_profile/pos_profile.json b/erpnext/accounts/doctype/pos_profile/pos_profile.json
index cc0b932..610ed51 100644
--- a/erpnext/accounts/doctype/pos_profile/pos_profile.json
+++ b/erpnext/accounts/doctype/pos_profile/pos_profile.json
@@ -1585,7 +1585,7 @@
  "issingle": 0, 
  "istable": 0, 
  "max_attachments": 0, 
- "modified": "2018-05-16 22:43:37.272875",
+ "modified": "2018-09-05 12:43:37.272875",
  "modified_by": "Administrator", 
  "module": "Accounts", 
  "name": "POS Profile", 
diff --git a/erpnext/accounts/doctype/sales_invoice/pos.py b/erpnext/accounts/doctype/sales_invoice/pos.py
index a14c234..4ec97c4 100755
--- a/erpnext/accounts/doctype/sales_invoice/pos.py
+++ b/erpnext/accounts/doctype/sales_invoice/pos.py
@@ -12,7 +12,7 @@
 from erpnext.stock.get_item_details import get_pos_profile
 from frappe import _
 from frappe.core.doctype.communication.email import make
-from frappe.utils import nowdate
+from frappe.utils import nowdate, cint
 
 from six import string_types, iteritems
 
@@ -514,7 +514,7 @@
 		name = frappe.db.get_value('Sales Invoice', {'offline_pos_name': key}, 'name')
 		data = json.loads(data)
 		sender = frappe.session.user
-		print_format = "POS Invoice"
+		print_format = "POS Invoice" if not cint(frappe.db.get_value('Print Format', 'POS Invoice', 'disabled')) else None
 		attachments = [frappe.attach_print('Sales Invoice', name, print_format=print_format)]
 
 		make(subject=data.get('subject'), content=data.get('content'), recipients=data.get('recipients'),
diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
index 4eeedac..4708edf 100644
--- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
+++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
@@ -305,9 +305,13 @@
 
 		super(SalesInvoice, self).set_missing_values(for_validate)
 
+		print_format = pos.get("print_format_for_online") if pos else None
+		if not print_format and not cint(frappe.db.get_value('Print Format', 'POS Invoice', 'disabled')):
+			print_format = 'POS Invoice'
+
 		if pos:
 			return {
-				"print_format": pos.get("print_format_for_online"),
+				"print_format": print_format,
 				"allow_edit_rate": pos.get("allow_user_to_edit_rate"),
 				"allow_edit_discount": pos.get("allow_user_to_edit_discount")
 			}
diff --git a/erpnext/accounts/report/sales_payment_summary/sales_payment_summary.py b/erpnext/accounts/report/sales_payment_summary/sales_payment_summary.py
index 2ad41d6..05c8fb7 100644
--- a/erpnext/accounts/report/sales_payment_summary/sales_payment_summary.py
+++ b/erpnext/accounts/report/sales_payment_summary/sales_payment_summary.py
@@ -37,7 +37,6 @@
 			_("Sales and Returns") + ":Currency/currency:120",
 			_("Taxes") + ":Currency/currency:120",
 			_("Payments") + ":Currency/currency:120",
-			_("Warehouse") + ":Data:200"
 		]
 
 
diff --git a/erpnext/buying/doctype/purchase_order_item/purchase_order_item.json b/erpnext/buying/doctype/purchase_order_item/purchase_order_item.json
index 7625416..d327874 100755
--- a/erpnext/buying/doctype/purchase_order_item/purchase_order_item.json
+++ b/erpnext/buying/doctype/purchase_order_item/purchase_order_item.json
@@ -2341,7 +2341,7 @@
  "issingle": 0, 
  "istable": 1, 
  "max_attachments": 0, 
- "modified": "2018-09-07 05:16:58.258276", 
+ "modified": "2018-09-07 07:16:58.258276", 
  "modified_by": "Administrator", 
  "module": "Buying", 
  "name": "Purchase Order Item", 
diff --git a/erpnext/erpnext_integrations/doctype/shopify_settings/shopify_settings.json b/erpnext/erpnext_integrations/doctype/shopify_settings/shopify_settings.json
index cf1c0ad..a7040f2 100644
--- a/erpnext/erpnext_integrations/doctype/shopify_settings/shopify_settings.json
+++ b/erpnext/erpnext_integrations/doctype/shopify_settings/shopify_settings.json
@@ -49,7 +49,7 @@
    "bold": 0, 
    "collapsible": 0, 
    "columns": 0, 
-   "default": "1", 
+   "default": "",
    "fieldname": "enable_shopify", 
    "fieldtype": "Check", 
    "hidden": 0, 
@@ -1219,7 +1219,7 @@
  "issingle": 1, 
  "istable": 0, 
  "max_attachments": 0, 
- "modified": "2018-04-11 19:04:53.396557", 
+ "modified": "2018-09-07 09:11:49.403176",
  "modified_by": "Administrator", 
  "module": "ERPNext Integrations", 
  "name": "Shopify Settings", 
@@ -1253,5 +1253,6 @@
  "sort_field": "modified", 
  "sort_order": "DESC", 
  "track_changes": 0, 
- "track_seen": 0
+ "track_seen": 0,
+ "track_views": 0
 }
\ No newline at end of file
diff --git a/erpnext/patches.txt b/erpnext/patches.txt
index 6b4d1f7..207719f 100644
--- a/erpnext/patches.txt
+++ b/erpnext/patches.txt
@@ -536,7 +536,7 @@
 erpnext.patches.v11_0.make_asset_finance_book_against_old_entries
 erpnext.patches.v11_0.check_buying_selling_in_currency_exchange
 erpnext.patches.v11_0.move_item_defaults_to_child_table_for_multicompany #02-07-2018
-erpnext.patches.v11_0.refactor_erpnext_shopify
+erpnext.patches.v11_0.refactor_erpnext_shopify #2018-09-07
 erpnext.patches.v11_0.rename_overproduction_percent_field
 erpnext.patches.v11_0.update_backflush_subcontract_rm_based_on_bom
 erpnext.patches.v10_0.update_status_in_purchase_receipt
diff --git a/erpnext/patches/v11_0/refactor_erpnext_shopify.py b/erpnext/patches/v11_0/refactor_erpnext_shopify.py
index 68a37d5..a91fda7 100644
--- a/erpnext/patches/v11_0/refactor_erpnext_shopify.py
+++ b/erpnext/patches/v11_0/refactor_erpnext_shopify.py
@@ -19,15 +19,26 @@
 		frappe.db.sql("truncate `tabShopify Log`")
 
 		setup_app_type()
+	else:
+		disable_shopify()
 
 def setup_app_type():
 	try:
 		shopify_settings = frappe.get_doc("Shopify Settings")
 		shopify_settings.app_type = 'Private'
-		shopify_settings.update_price_in_erpnext_price_list =  0 if getattr(shopify_settings, 'push_prices_to_shopify', None) else 1
+		shopify_settings.update_price_in_erpnext_price_list = 0 if getattr(shopify_settings, 'push_prices_to_shopify', None) else 1
 		shopify_settings.flags.ignore_mandatory = True
 		shopify_settings.ignore_permissions = True
 		shopify_settings.save()
 	except Exception:
-		frappe.db.set_value("Shopify Shopify", None, "enable_shopify", 0)
-		frappe.log_error(frappe.get_traceback())
\ No newline at end of file
+		frappe.db.set_value("Shopify Settings", None, "enable_shopify", 0)
+		frappe.log_error(frappe.get_traceback())
+
+def disable_shopify():
+	# due to frappe.db.set_value wrongly written and enable_shopify being default 1
+	# Shopify Settings isn't properly configured and leads to error
+	shopify = frappe.get_doc('Shopify Settings')
+
+	if shopify.app_type == "Public" or shopify.app_type == None or \
+		(shopify.enable_shopify and not (shopify.shopify_url or shopify.api_key)):
+		frappe.db.set_value("Shopify Settings", None, "enable_shopify", 0)
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 da72dc5..a6f7a28 100644
--- a/erpnext/selling/page/point_of_sale/point_of_sale.js
+++ b/erpnext/selling/page/point_of_sale/point_of_sale.js
@@ -519,7 +519,7 @@
 					this.frm.cscript.calculate_taxes_and_totals();
 
 					if (r.message) {
-						this.frm.meta.default_print_format = r.message.print_format || 'POS Invoice';
+						this.frm.meta.default_print_format = r.message.print_format || "";
 						this.frm.allow_edit_rate = r.message.allow_edit_rate;
 						this.frm.allow_edit_discount = r.message.allow_edit_discount;
 					}
diff --git a/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.js b/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.js
index ce32e01..4d34d96 100644
--- a/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.js
+++ b/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.js
@@ -42,7 +42,14 @@
 	},
 
 	get_items: function(frm) {
-		frappe.prompt({label:"Warehouse", fieldtype:"Link", options:"Warehouse", reqd: 1},
+		frappe.prompt({label:"Warehouse", fieldtype:"Link", options:"Warehouse", reqd: 1,
+			"get_query": function() {
+				return {
+					"filters": {
+						"company": frm.doc.company,
+					}
+				}
+			}},
 			function(data) {
 				frappe.call({
 					method:"erpnext.stock.doctype.stock_reconciliation.stock_reconciliation.get_items",
diff --git a/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py b/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py
index d29ea9c..363db39 100644
--- a/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py
+++ b/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py
@@ -271,28 +271,27 @@
 
 @frappe.whitelist()
 def get_items(warehouse, posting_date, posting_time, company):
-	items = [d.item_code for d in frappe.get_list("Bin", fields=["item_code"], filters={"warehouse": warehouse})]
+	items = frappe.db.sql('''select i.name, i.item_name from `tabItem` i, `tabBin` bin where i.name=bin.item_code
+		and i.disabled=0 and bin.warehouse=%s''', (warehouse), as_dict=True)
 
-	items += frappe.db.sql_list('''select i.name from `tabItem` i, `tabItem Default` id where i.name = id.parent
+	items += frappe.db.sql('''select i.name, i.item_name from `tabItem` i, `tabItem Default` id where i.name = id.parent
 		and i.is_stock_item=1 and i.has_serial_no=0 and i.has_batch_no=0 and i.has_variants=0 and i.disabled=0
-		and id.default_warehouse=%s and id.company=%s''', (warehouse, company))
+		and id.default_warehouse=%s and id.company=%s group by i.name''', (warehouse, company), as_dict=True)
 
 	res = []
-	for item in set(items):
-		stock_bal = get_stock_balance(item[0], warehouse, posting_date, posting_time,
+	for item in items:
+		qty, rate = get_stock_balance(item.name, warehouse, posting_date, posting_time,
 			with_valuation_rate=True)
 
-		if frappe.db.get_value("Item",item[0],"disabled") == 0:
-
-			res.append({
-				"item_code": item[0],
-				"warehouse": warehouse,
-				"qty": stock_bal[0],
-				"item_name": frappe.db.get_value('Item', item[0], 'item_name'),
-				"valuation_rate": stock_bal[1],
-				"current_qty": stock_bal[0],
-				"current_valuation_rate": stock_bal[1]
-			})
+		res.append({
+			"item_code": item.name,
+			"warehouse": warehouse,
+			"qty": qty,
+			"item_name": item.item_name,
+			"valuation_rate": rate,
+			"current_qty": qty,
+			"current_valuation_rate": rate
+		})
 
 	return res