Merge branch 'nabinhait-tax_rule_patch' into develop
diff --git a/erpnext/__version__.py b/erpnext/__version__.py
index d004216..e0496c6 100644
--- a/erpnext/__version__.py
+++ b/erpnext/__version__.py
@@ -1,2 +1,2 @@
 from __future__ import unicode_literals
-__version__ = '6.12.3'
+__version__ = '6.12.4'
diff --git a/erpnext/accounts/doctype/sales_invoice/pos.py b/erpnext/accounts/doctype/sales_invoice/pos.py
index 145766f..18faae7 100644
--- a/erpnext/accounts/doctype/sales_invoice/pos.py
+++ b/erpnext/accounts/doctype/sales_invoice/pos.py
@@ -52,4 +52,5 @@
 			{condition}
 		order by
 			{order_by}
-			i.name""".format(condition=condition, order_by=order_by), args, as_dict=1)
+			i.name
+		limit 24""".format(condition=condition, order_by=order_by), args, as_dict=1)
diff --git a/erpnext/accounts/report/bank_reconciliation_statement/bank_reconciliation_statement.html b/erpnext/accounts/report/bank_reconciliation_statement/bank_reconciliation_statement.html
index d749383..ee77085 100644
--- a/erpnext/accounts/report/bank_reconciliation_statement/bank_reconciliation_statement.html
+++ b/erpnext/accounts/report/bank_reconciliation_statement/bank_reconciliation_statement.html
@@ -2,7 +2,7 @@
 	{%= frappe.boot.letter_heads[frappe.defaults.get_default("letter_head")] %}
 </div>
 <h2 class="text-center">{%= __("Bank Reconciliation Statement") %}</h2>
-<h4 class="text-center">{%= filters.account && (filters.account + ", ")  || "" %} {%= filters.company %}</h4>
+<h4 class="text-center">{%= filters.account %}</h4>
 <hr>
 <table class="table table-bordered">
 	<thead>
@@ -16,31 +16,31 @@
 	</thead>
 	<tbody>
 		{% for(var i=0, l=data.length; i<l; i++) { %}
-			{% if (data[i][__("Posting Date")]) { %}
+			{% if (data[i]["posting_date"]) { %}
 			<tr>
-				<td>{%= dateutil.str_to_user(data[i][__("Posting Date")]) %}</td>
-				<td>{%= data[i][__("Journal Entry")] %}</td>
-				<td>{%= __("Against") %}: {%= data[i][__("Against Account")] %}
-					{% if (data[i][__("Reference")]) { %}
-						<br>{%= __("Reference") %}: {%= data[i][__("Reference")] %}
-						{% if (data[i][__("Ref Date")]) { %}
-							<br>{%= __("Reference Date") %}: {%= dateutil.str_to_user(data[i][__("Ref Date")]) %}
+				<td>{%= dateutil.str_to_user(data[i]["posting_date"]) %}</td>
+				<td>{%= data[i]["journal_entry"] %}</td>
+				<td>{%= __("Against") %}: {%= data[i]["against_account"] %}
+					{% if (data[i]["reference"]) { %}
+						<br>{%= __("Reference") %}: {%= data[i]["reference"] %}
+						{% if (data[i]["ref_date"]) { %}
+							<br>{%= __("Reference Date") %}: {%= dateutil.str_to_user(data[i]["ref_date"]) %}
 						{% } %}
 					{% } %}
-					{% if (data[i][__("Clearance Date")]) { %}
-						<br>{%= __("Clearance Date") %}: {%= dateutil.str_to_user(data[i][__("Clearance Date")]) %}
+					{% if (data[i]["clearance_date"]) { %}
+						<br>{%= __("Clearance Date") %}: {%= dateutil.str_to_user(data[i]["clearance_date"]) %}
 					{% } %}
 				</td>
-				<td style="text-align: right">{%= format_currency(data[i][__("Debit")]) %}</td>
-				<td style="text-align: right">{%= format_currency(data[i][__("Credit")]) %}</td>
+				<td style="text-align: right">{%= format_currency(data[i]["debit"]) %}</td>
+				<td style="text-align: right">{%= format_currency(data[i]["credit"]) %}</td>
 			</tr>
 			{% } else { %}
 			<tr>
 				<td></td>
 				<td></td>
-				<td>{%= data[i][__("Journal Entry")] %}</td>
-				<td style="text-align: right">{%= format_currency(data[i][__("Debit")]) %}</td>
-				<td style="text-align: right">{%= format_currency(data[i][__("Credit")]) %}</td>
+				<td>{%= data[i]["journal_entry"] %}</td>
+				<td style="text-align: right">{%= format_currency(data[i]["debit"]) %}</td>
+				<td style="text-align: right">{%= format_currency(data[i]["credit"]) %}</td>
 			</tr>
 			{% } %}
 		{% } %}
diff --git a/erpnext/buying/doctype/purchase_order/purchase_order.py b/erpnext/buying/doctype/purchase_order/purchase_order.py
index feb144d..b10b72f 100644
--- a/erpnext/buying/doctype/purchase_order/purchase_order.py
+++ b/erpnext/buying/doctype/purchase_order/purchase_order.py
@@ -159,6 +159,7 @@
 	def on_cancel(self):
 		if self.has_drop_ship_item():
 			self.update_status_updater()
+			self.update_delivered_qty_in_sales_order()
 
 		pc_obj = frappe.get_doc('Purchase Common')
 		self.check_for_stopped_or_closed_status(pc_obj)
@@ -216,7 +217,7 @@
 
 		for so_name in sales_orders_to_update:
 			so = frappe.get_doc("Sales Order", so_name)
-			so.update_delivery_status(self.name)
+			so.update_delivery_status()
 			so.set_status(update=True)
 			so.notify_update()
 
diff --git a/erpnext/buying/doctype/supplier/supplier.json b/erpnext/buying/doctype/supplier/supplier.json
index 23ae746..498154b 100644
--- a/erpnext/buying/doctype/supplier/supplier.json
+++ b/erpnext/buying/doctype/supplier/supplier.json
@@ -27,6 +27,7 @@
    "options": "icon-user", 
    "permlevel": 0, 
    "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 0, 
    "reqd": 0, 
@@ -52,6 +53,7 @@
    "options": "SUPP-", 
    "permlevel": 0, 
    "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 0, 
    "reqd": 0, 
@@ -76,6 +78,7 @@
    "oldfieldtype": "Data", 
    "permlevel": 0, 
    "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 0, 
    "reqd": 1, 
@@ -97,6 +100,7 @@
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 0, 
    "reqd": 0, 
@@ -123,6 +127,7 @@
    "options": "Supplier Type", 
    "permlevel": 0, 
    "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 0, 
    "reqd": 1, 
@@ -146,6 +151,7 @@
    "permlevel": 0, 
    "precision": "", 
    "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 0, 
    "reqd": 0, 
@@ -168,6 +174,7 @@
    "permlevel": 0, 
    "precision": "", 
    "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 0, 
    "reqd": 0, 
@@ -191,6 +198,7 @@
    "options": "Currency", 
    "permlevel": 0, 
    "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 0, 
    "reqd": 0, 
@@ -214,51 +222,7 @@
    "options": "Price List", 
    "permlevel": 0, 
    "print_hide": 0, 
-   "read_only": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
-   "unique": 0
-  }, 
-  {
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "fieldname": "column_break_10", 
-   "fieldtype": "Column Break", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "in_filter": 0, 
-   "in_list_view": 0, 
-   "length": 0, 
-   "no_copy": 0, 
-   "permlevel": 0, 
-   "precision": "", 
-   "print_hide": 0, 
-   "read_only": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
-   "unique": 0
-  }, 
-  {
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "fieldname": "default_taxes_and_charges", 
-   "fieldtype": "Link", 
-   "hidden": 0, 
-   "ignore_user_permissions": 1, 
-   "in_filter": 0, 
-   "in_list_view": 0, 
-   "label": "Taxes and Charges", 
-   "length": 0, 
-   "no_copy": 0, 
-   "options": "Purchase Taxes and Charges Template", 
-   "permlevel": 0, 
-   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 0, 
    "reqd": 0, 
@@ -281,6 +245,7 @@
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 0, 
    "reqd": 0, 
@@ -306,6 +271,7 @@
    "options": "icon-map-marker", 
    "permlevel": 0, 
    "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 0, 
    "reqd": 0, 
@@ -328,6 +294,7 @@
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
    "read_only": 1, 
    "report_hide": 0, 
    "reqd": 0, 
@@ -349,6 +316,7 @@
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 0, 
    "reqd": 0, 
@@ -372,6 +340,7 @@
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
    "read_only": 1, 
    "report_hide": 0, 
    "reqd": 0, 
@@ -395,6 +364,7 @@
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 0, 
    "reqd": 0, 
@@ -420,6 +390,7 @@
    "options": "Party Account", 
    "permlevel": 0, 
    "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 0, 
    "reqd": 0, 
@@ -443,6 +414,7 @@
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 0, 
    "reqd": 0, 
@@ -468,6 +440,7 @@
    "oldfieldtype": "Data", 
    "permlevel": 0, 
    "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 0, 
    "reqd": 0, 
@@ -493,6 +466,7 @@
    "oldfieldtype": "Code", 
    "permlevel": 0, 
    "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 0, 
    "reqd": 0, 
@@ -516,6 +490,7 @@
    "options": "Communication", 
    "permlevel": 0, 
    "print_hide": 1, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 0, 
    "reqd": 0, 
@@ -534,7 +509,7 @@
  "issingle": 0, 
  "istable": 0, 
  "max_attachments": 0, 
- "modified": "2015-11-16 06:29:58.500467", 
+ "modified": "2015-12-08 12:52:56.827461", 
  "modified_by": "Administrator", 
  "module": "Buying", 
  "name": "Supplier", 
diff --git a/erpnext/controllers/status_updater.py b/erpnext/controllers/status_updater.py
index eb8d5e9..73e9d7f 100644
--- a/erpnext/controllers/status_updater.py
+++ b/erpnext/controllers/status_updater.py
@@ -76,10 +76,10 @@
 		self.update_qty()
 		self.validate_qty()
 
-	def set_status(self, update=False, status=None):
+	def set_status(self, update=False, status=None, update_modified=True):
 		if self.is_new():
 			return
-
+				
 		if self.doctype in status_map:
 			_status = self.status
 
@@ -102,9 +102,10 @@
 
 			if self.status != _status and self.status not in ("Submitted", "Cancelled"):
 				self.add_comment("Label", _(self.status))
-
+			
 			if update:
-				frappe.db.set_value(self.doctype, self.name, "status", self.status)
+				frappe.db.set_value(self.doctype, self.name, "status", self.status, 
+					update_modified=update_modified)
 
 	def validate_qty(self):
 		"""Validates qty at row level"""
diff --git a/erpnext/docs/current/api/buying/print_format/drop_shipping/index.txt b/erpnext/docs/current/api/buying/print_format/drop_shipping/index.txt
deleted file mode 100644
index 5c383bd..0000000
--- a/erpnext/docs/current/api/buying/print_format/drop_shipping/index.txt
+++ /dev/null
@@ -1 +0,0 @@
-erpnext.buying.print_format.drop_shipping
\ No newline at end of file
diff --git a/erpnext/docs/current/api/buying/print_format/drop_shipping/erpnext.buying.print_format.drop_shipping.html b/erpnext/docs/current/api/buying/print_format/drop_shipping_format/erpnext.buying.print_format.drop_shipping_format.html
similarity index 78%
rename from erpnext/docs/current/api/buying/print_format/drop_shipping/erpnext.buying.print_format.drop_shipping.html
rename to erpnext/docs/current/api/buying/print_format/drop_shipping_format/erpnext.buying.print_format.drop_shipping_format.html
index d84423e..9c2648b 100644
--- a/erpnext/docs/current/api/buying/print_format/drop_shipping/erpnext.buying.print_format.drop_shipping.html
+++ b/erpnext/docs/current/api/buying/print_format/drop_shipping_format/erpnext.buying.print_format.drop_shipping_format.html
@@ -1,10 +1,10 @@
-<!-- title: erpnext.buying.print_format.drop_shipping --><div class="dev-header">
+<!-- title: erpnext.buying.print_format.drop_shipping_format --><div class="dev-header">
 
 <a class="btn btn-default btn-sm" disabled style="margin-bottom: 10px;">
 	Version 6.x.x</a>
 
 
-	<a class="btn btn-default btn-sm" href="https://github.com/frappe/erpnext/blob/develop/erpnext/buying/print_format/drop_shipping.py"
+	<a class="btn btn-default btn-sm" href="https://github.com/frappe/erpnext/blob/develop/erpnext/buying/print_format/drop_shipping_format.py"
 		target="_blank" style="margin-left: 10px; margin-bottom: 10px;"><i class="octicon octicon-mark-github"></i> Source</a>
 
 </div>
diff --git a/erpnext/docs/current/api/buying/print_format/drop_shipping/index.html b/erpnext/docs/current/api/buying/print_format/drop_shipping_format/index.html
similarity index 81%
rename from erpnext/docs/current/api/buying/print_format/drop_shipping/index.html
rename to erpnext/docs/current/api/buying/print_format/drop_shipping_format/index.html
index 47647f0..ef09e77 100644
--- a/erpnext/docs/current/api/buying/print_format/drop_shipping/index.html
+++ b/erpnext/docs/current/api/buying/print_format/drop_shipping_format/index.html
@@ -1,4 +1,4 @@
-<!-- title: drop_shipping -->
+<!-- title: drop_shipping_format -->
 
 
 <div class="dev-header">
@@ -7,7 +7,7 @@
 	Version 6.x.x</a>
 
 
-	<a class="btn btn-default btn-sm" href="https://github.com/frappe/erpnext/tree/develop/drop_shipping"
+	<a class="btn btn-default btn-sm" href="https://github.com/frappe/erpnext/tree/develop/drop_shipping_format"
 		target="_blank" style="margin-left: 10px; margin-bottom: 10px;"><i class="octicon octicon-mark-github"></i> Source</a>
 
 </div>
diff --git a/erpnext/docs/current/api/buying/print_format/drop_shipping_format/index.txt b/erpnext/docs/current/api/buying/print_format/drop_shipping_format/index.txt
new file mode 100644
index 0000000..590a2c9
--- /dev/null
+++ b/erpnext/docs/current/api/buying/print_format/drop_shipping_format/index.txt
@@ -0,0 +1 @@
+erpnext.buying.print_format.drop_shipping_format
\ No newline at end of file
diff --git a/erpnext/docs/current/api/stock/erpnext.stock.utils.html b/erpnext/docs/current/api/stock/erpnext.stock.utils.html
index 7f2d4e2..1fb0155 100644
--- a/erpnext/docs/current/api/stock/erpnext.stock.utils.html
+++ b/erpnext/docs/current/api/stock/erpnext.stock.utils.html
@@ -79,7 +79,9 @@
 	
         
     
-    
+    <p><span class="label label-info">Public API</span>
+        <br><code>/api/method/erpnext.stock.utils.get_incoming_rate</code>
+    </p>
 	<p class="docs-attr-name">
         <a name="erpnext.stock.utils.get_incoming_rate" href="#erpnext.stock.utils.get_incoming_rate" class="text-muted small">
             <i class="icon-link small" style="color: #ccc;"></i></a>
diff --git a/erpnext/docs/current/models/accounts/sales_invoice.html b/erpnext/docs/current/models/accounts/sales_invoice.html
index 8f0f364..76924c3 100644
--- a/erpnext/docs/current/models/accounts/sales_invoice.html
+++ b/erpnext/docs/current/models/accounts/sales_invoice.html
@@ -2476,6 +2476,20 @@
     
     
 	<p class="docs-attr-name">
+        <a name="validate_dropship_item" href="#validate_dropship_item" class="text-muted small">
+            <i class="icon-link small" style="color: #ccc;"></i></a>
+		<b>validate_dropship_item</b>
+        <i class="text-muted">(self)</i>
+    </p>
+	<div class="docs-attr-desc"><p><span class="text-muted">No docs</span></p>
+</div>
+	<br>
+
+        
+        
+    
+    
+	<p class="docs-attr-name">
         <a name="validate_fixed_asset_account" href="#validate_fixed_asset_account" class="text-muted small">
             <i class="icon-link small" style="color: #ccc;"></i></a>
 		<b>validate_fixed_asset_account</b>
diff --git a/erpnext/docs/current/models/home/index.html b/erpnext/docs/current/models/home/index.html
deleted file mode 100644
index e21468e..0000000
--- a/erpnext/docs/current/models/home/index.html
+++ /dev/null
@@ -1,19 +0,0 @@
-<!-- title: Module home -->
-
-
-<div class="dev-header">
-
-<a class="btn btn-default btn-sm" disabled style="margin-bottom: 10px;">
-	Version 6.x.x</a>
-
-
-	<a class="btn btn-default btn-sm" href="https://github.com/frappe/erpnext/tree/develop/erpnext/home"
-		target="_blank" style="margin-left: 10px; margin-bottom: 10px;"><i class="octicon octicon-mark-github"></i> Source</a>
-
-</div>
-
-<h3>DocTypes for home</h3>
-
-{index}
-
-<!-- autodoc -->
\ No newline at end of file
diff --git a/erpnext/docs/current/models/home/index.txt b/erpnext/docs/current/models/home/index.txt
deleted file mode 100644
index e69de29..0000000
--- a/erpnext/docs/current/models/home/index.txt
+++ /dev/null
diff --git a/erpnext/docs/current/models/hr/leave_application.html b/erpnext/docs/current/models/hr/leave_application.html
index bc91ea5..e40ce3a 100644
--- a/erpnext/docs/current/models/hr/leave_application.html
+++ b/erpnext/docs/current/models/hr/leave_application.html
@@ -867,7 +867,7 @@
         <a name="erpnext.hr.doctype.leave_application.leave_application.get_leave_balance_on" href="#erpnext.hr.doctype.leave_application.leave_application.get_leave_balance_on" class="text-muted small">
             <i class="icon-link small" style="color: #ccc;"></i></a>
 		erpnext.hr.doctype.leave_application.leave_application.<b>get_leave_balance_on</b>
-        <i class="text-muted">(employee, leave_type, date, allocation_records=None)</i>
+        <i class="text-muted">(employee, leave_type, date, allocation_records=None, consider_all_leaves_in_the_allocation_period=False)</i>
     </p>
 	<div class="docs-attr-desc"><p><span class="text-muted">No docs</span></p>
 </div>
diff --git a/erpnext/docs/user/manual/en/customize-erpnext/articles/index.txt b/erpnext/docs/user/manual/en/customize-erpnext/articles/index.txt
index 3ac0897..a810705 100644
--- a/erpnext/docs/user/manual/en/customize-erpnext/articles/index.txt
+++ b/erpnext/docs/user/manual/en/customize-erpnext/articles/index.txt
@@ -9,8 +9,8 @@
 making-custom-reports-in-erpnext
 managing-dynamic-link-fields
 module-visibility
-perm-level-error-in-permission-manager-1
+perm-level-error-in-permission-manager
 search-record-by-specific-field
 set-language
 set-precision-for-float-currency-and-percent-fields
-user-restriction
\ No newline at end of file
+user-restriction
diff --git a/erpnext/docs/user/manual/en/customize-erpnext/articles/perm-level-error-in-permission-manager-1.md b/erpnext/docs/user/manual/en/customize-erpnext/articles/perm-level-error-in-permission-manager.md
similarity index 100%
rename from erpnext/docs/user/manual/en/customize-erpnext/articles/perm-level-error-in-permission-manager-1.md
rename to erpnext/docs/user/manual/en/customize-erpnext/articles/perm-level-error-in-permission-manager.md
diff --git a/erpnext/hooks.py b/erpnext/hooks.py
index 744db44..22a093d 100644
--- a/erpnext/hooks.py
+++ b/erpnext/hooks.py
@@ -7,7 +7,7 @@
 app_description = """ERP made simple"""
 app_icon = "icon-th"
 app_color = "#e74c3c"
-app_version = "6.12.3"
+app_version = "6.12.4"
 app_email = "info@erpnext.com"
 app_license = "GNU General Public License (v3)"
 source_link = "https://github.com/frappe/erpnext"
@@ -111,6 +111,9 @@
 	"Price List": {
 		"on_update": "erpnext.shopping_cart.doctype.shopping_cart_settings.shopping_cart_settings.validate_cart_settings"
 	},
+	"Address": {
+		"validate": "erpnext.shopping_cart.cart.set_customer_in_address"
+	}
 }
 
 scheduler_events = {
diff --git a/erpnext/patches.txt b/erpnext/patches.txt
index cd38e67..f522b18 100644
--- a/erpnext/patches.txt
+++ b/erpnext/patches.txt
@@ -209,7 +209,6 @@
 erpnext.patches.v6_0.multi_currency
 erpnext.patches.v6_2.remove_newsletter_duplicates
 erpnext.patches.v6_2.fix_missing_default_taxes_and_lead
-erpnext.patches.v5_8.tax_rule
 erpnext.patches.v6_3.convert_applicable_territory
 erpnext.patches.v6_4.round_status_updater_percentages
 erpnext.patches.v6_4.repost_gle_for_journal_entries_where_reference_name_missing
@@ -237,4 +236,6 @@
 erpnext.patches.v6_10.fix_ordered_received_billed
 erpnext.patches.v6_10.fix_jv_total_amount #2015-11-30
 erpnext.patches.v6_10.email_digest_default_quote
-erpnext.patches.v6_10.fix_billed_amount_in_drop_ship_po
\ No newline at end of file
+erpnext.patches.v6_10.fix_billed_amount_in_drop_ship_po
+erpnext.patches.v6_10.fix_delivery_status_of_drop_ship_item
+erpnext.patches.v5_8.tax_rule #2015-12-08
diff --git a/erpnext/patches/v5_8/tax_rule.py b/erpnext/patches/v5_8/tax_rule.py
index 80a2364..4a62501 100644
--- a/erpnext/patches/v5_8/tax_rule.py
+++ b/erpnext/patches/v5_8/tax_rule.py
@@ -11,19 +11,21 @@
 		ifnull(default_taxes_and_charges, '') != '' """, as_dict=1)
 
 	for d in customers:
-		tr = frappe.new_doc("Tax Rule")
-		tr.tax_type = "Sales"
-		tr.customer = d.name
-		tr.sales_tax_template = d.default_taxes_and_charges
-		tr.save()
+		if not frappe.db.exists({"doctype": "Tax Rule", "customer": d.name}):
+			tr = frappe.new_doc("Tax Rule")
+			tr.tax_type = "Sales"
+			tr.customer = d.name
+			tr.sales_tax_template = d.default_taxes_and_charges
+			tr.save()
 
 
 	suppliers = frappe.db.sql("""select name, default_taxes_and_charges from tabSupplier where
 		ifnull(default_taxes_and_charges, '') != '' """, as_dict=1)
 
 	for d in suppliers:
-		tr = frappe.new_doc("Tax Rule")
-		tr.tax_type = "Purchase"
-		tr.supplier = d.name
-		tr.purchase_tax_template = d.default_taxes_and_charges
-		tr.save()
+		if not frappe.db.exists({"doctype": "Tax Rule", "supplier": d.name}):
+			tr = frappe.new_doc("Tax Rule")
+			tr.tax_type = "Purchase"
+			tr.supplier = d.name
+			tr.purchase_tax_template = d.default_taxes_and_charges
+			tr.save()
\ No newline at end of file
diff --git a/erpnext/patches/v6_10/fix_delivery_status_of_drop_ship_item.py b/erpnext/patches/v6_10/fix_delivery_status_of_drop_ship_item.py
new file mode 100644
index 0000000..a54d0ab
--- /dev/null
+++ b/erpnext/patches/v6_10/fix_delivery_status_of_drop_ship_item.py
@@ -0,0 +1,17 @@
+from __future__ import unicode_literals
+import frappe
+
+def execute():
+	sales_orders_to_update = []
+
+	for item in frappe.get_all("Purchase Order Item", filters={"delivered_by_supplier": 1}, 
+		fields=["prevdoc_doctype", "prevdoc_docname"]):
+		
+		if item.prevdoc_doctype == "Sales Order":
+			if item.prevdoc_docname not in sales_orders_to_update:
+				sales_orders_to_update.append(item.prevdoc_docname)
+
+	for so_name in sales_orders_to_update:
+		so = frappe.get_doc("Sales Order", so_name)
+		so.update_delivery_status()
+		so.set_status(update=True, update_modified=False)
\ No newline at end of file
diff --git a/erpnext/selling/doctype/customer/customer.json b/erpnext/selling/doctype/customer/customer.json
index e8efd5c..f27fdbf 100644
--- a/erpnext/selling/doctype/customer/customer.json
+++ b/erpnext/selling/doctype/customer/customer.json
@@ -27,6 +27,7 @@
    "options": "icon-user", 
    "permlevel": 0, 
    "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 0, 
    "reqd": 0, 
@@ -50,6 +51,7 @@
    "options": "CUST-", 
    "permlevel": 0, 
    "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 0, 
    "reqd": 0, 
@@ -74,6 +76,7 @@
    "oldfieldtype": "Data", 
    "permlevel": 0, 
    "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 0, 
    "reqd": 1, 
@@ -99,6 +102,7 @@
    "options": "\nCompany\nIndividual", 
    "permlevel": 0, 
    "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 0, 
    "reqd": 1, 
@@ -124,6 +128,7 @@
    "options": "Lead", 
    "permlevel": 0, 
    "print_hide": 1, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 1, 
    "reqd": 0, 
@@ -145,6 +150,7 @@
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 0, 
    "reqd": 0, 
@@ -172,6 +178,7 @@
    "options": "Customer Group", 
    "permlevel": 0, 
    "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 0, 
    "reqd": 1, 
@@ -198,6 +205,7 @@
    "options": "Territory", 
    "permlevel": 0, 
    "print_hide": 1, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 0, 
    "reqd": 1, 
@@ -221,6 +229,7 @@
    "permlevel": 0, 
    "precision": "", 
    "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 0, 
    "reqd": 0, 
@@ -244,6 +253,7 @@
    "permlevel": 0, 
    "precision": "", 
    "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 0, 
    "reqd": 0, 
@@ -267,6 +277,7 @@
    "permlevel": 0, 
    "precision": "", 
    "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 0, 
    "reqd": 0, 
@@ -290,6 +301,7 @@
    "options": "Currency", 
    "permlevel": 0, 
    "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 0, 
    "reqd": 0, 
@@ -313,51 +325,7 @@
    "options": "Price List", 
    "permlevel": 0, 
    "print_hide": 0, 
-   "read_only": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
-   "unique": 0
-  }, 
-  {
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "fieldname": "column_break_14", 
-   "fieldtype": "Column Break", 
-   "hidden": 0, 
-   "ignore_user_permissions": 0, 
-   "in_filter": 0, 
-   "in_list_view": 0, 
-   "length": 0, 
-   "no_copy": 0, 
-   "permlevel": 0, 
-   "precision": "", 
-   "print_hide": 0, 
-   "read_only": 0, 
-   "report_hide": 0, 
-   "reqd": 0, 
-   "search_index": 0, 
-   "set_only_once": 0, 
-   "unique": 0
-  }, 
-  {
-   "allow_on_submit": 0, 
-   "bold": 0, 
-   "collapsible": 0, 
-   "fieldname": "default_taxes_and_charges", 
-   "fieldtype": "Link", 
-   "hidden": 0, 
-   "ignore_user_permissions": 1, 
-   "in_filter": 0, 
-   "in_list_view": 0, 
-   "label": "Default Taxes and Charges", 
-   "length": 0, 
-   "no_copy": 0, 
-   "options": "Sales Taxes and Charges Template", 
-   "permlevel": 0, 
-   "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 0, 
    "reqd": 0, 
@@ -382,6 +350,7 @@
    "options": "icon-map-marker", 
    "permlevel": 0, 
    "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 0, 
    "reqd": 0, 
@@ -404,6 +373,7 @@
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
    "read_only": 1, 
    "report_hide": 0, 
    "reqd": 0, 
@@ -425,6 +395,7 @@
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 0, 
    "reqd": 0, 
@@ -449,6 +420,7 @@
    "oldfieldtype": "HTML", 
    "permlevel": 0, 
    "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
    "read_only": 1, 
    "report_hide": 0, 
    "reqd": 0, 
@@ -472,6 +444,7 @@
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 0, 
    "reqd": 0, 
@@ -497,6 +470,7 @@
    "options": "Party Account", 
    "permlevel": 0, 
    "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 0, 
    "reqd": 0, 
@@ -520,6 +494,7 @@
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 0, 
    "reqd": 0, 
@@ -545,6 +520,7 @@
    "permlevel": 0, 
    "precision": "", 
    "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 0, 
    "reqd": 0, 
@@ -570,6 +546,7 @@
    "oldfieldtype": "Int", 
    "permlevel": 1, 
    "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 0, 
    "reqd": 0, 
@@ -595,6 +572,7 @@
    "options": "", 
    "permlevel": 1, 
    "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 0, 
    "reqd": 0, 
@@ -620,6 +598,7 @@
    "options": "icon-file-text", 
    "permlevel": 0, 
    "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 0, 
    "reqd": 0, 
@@ -645,6 +624,7 @@
    "oldfieldtype": "Code", 
    "permlevel": 0, 
    "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 0, 
    "reqd": 0, 
@@ -667,6 +647,7 @@
    "no_copy": 0, 
    "permlevel": 0, 
    "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 0, 
    "reqd": 0, 
@@ -692,6 +673,7 @@
    "options": "icon-group", 
    "permlevel": 0, 
    "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 0, 
    "reqd": 0, 
@@ -717,6 +699,7 @@
    "options": "Sales Partner", 
    "permlevel": 0, 
    "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 0, 
    "reqd": 0, 
@@ -741,6 +724,7 @@
    "oldfieldtype": "Currency", 
    "permlevel": 0, 
    "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 0, 
    "reqd": 0, 
@@ -765,6 +749,7 @@
    "permlevel": 0, 
    "precision": "", 
    "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 0, 
    "reqd": 0, 
@@ -790,6 +775,7 @@
    "options": "Sales Team", 
    "permlevel": 0, 
    "print_hide": 0, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 0, 
    "reqd": 0, 
@@ -813,6 +799,7 @@
    "options": "Communication", 
    "permlevel": 0, 
    "print_hide": 1, 
+   "print_hide_if_no_value": 0, 
    "read_only": 0, 
    "report_hide": 0, 
    "reqd": 0, 
@@ -831,7 +818,7 @@
  "issingle": 0, 
  "istable": 0, 
  "max_attachments": 0, 
- "modified": "2015-11-16 06:29:44.236132", 
+ "modified": "2015-12-08 12:50:05.106006", 
  "modified_by": "Administrator", 
  "module": "Selling", 
  "name": "Customer", 
diff --git a/erpnext/selling/doctype/sales_order/sales_order.py b/erpnext/selling/doctype/sales_order/sales_order.py
index 05cb50c..7712f5e 100644
--- a/erpnext/selling/doctype/sales_order/sales_order.py
+++ b/erpnext/selling/doctype/sales_order/sales_order.py
@@ -265,27 +265,29 @@
 		if exc_list:
 			frappe.throw('\n'.join(exc_list))
 
-	def update_delivery_status(self, po_name):
+	def update_delivery_status(self):
 		"""Update delivery status from Purchase Order for drop shipping"""
 		tot_qty, delivered_qty = 0.0, 0.0
 
 		for item in self.items:
 			if item.delivered_by_supplier:
-				item_delivered_qty  = frappe.db.sql("""select qty
+				item_delivered_qty  = frappe.db.sql("""select sum(qty)
 					from `tabPurchase Order Item` poi, `tabPurchase Order` po
-					where poi.prevdoc_docname = %s
+					where poi.prevdoc_detail_docname = %s
 						and poi.prevdoc_doctype = 'Sales Order'
 						and poi.item_code = %s
 						and poi.parent = po.name
-						and po.status = 'Delivered'""", (self.name, item.item_code))
+						and po.docstatus = 1
+						and po.status = 'Delivered'""", (item.name, item.item_code))
 
 				item_delivered_qty = item_delivered_qty[0][0] if item_delivered_qty else 0
-				item.db_set("delivered_qty", item_delivered_qty)
+				item.db_set("delivered_qty", flt(item_delivered_qty), update_modified=False)
 
 			delivered_qty += item.delivered_qty
 			tot_qty += item.qty
-
-		frappe.db.set_value("Sales Order", self.name, "per_delivered", flt(delivered_qty/tot_qty) * 100)
+			
+		frappe.db.set_value("Sales Order", self.name, "per_delivered", flt(delivered_qty/tot_qty) * 100, 
+		update_modified=False)
 
 def get_list_context(context=None):
 	from erpnext.controllers.website_list_for_contact import get_list_context
diff --git a/erpnext/shopping_cart/cart.py b/erpnext/shopping_cart/cart.py
index c116bdc..561a50c 100644
--- a/erpnext/shopping_cart/cart.py
+++ b/erpnext/shopping_cart/cart.py
@@ -280,6 +280,7 @@
 		user = frappe.session.user
 
 	customer = frappe.db.get_value("Contact", {"email_id": user}, "customer")
+
 	if customer:
 		return frappe.get_doc("Customer", customer)
 
@@ -320,6 +321,17 @@
 
 	return address_docs
 
+def set_customer_in_address(doc, method=None):
+	if doc.flags.linked:
+		return
+
+	doc.check_if_linked()
+
+	if not doc.flags.linked and (frappe.db.get_value("User", frappe.session.user, "user_type") == "Website User"):
+		# creates a customer if one does not exist
+		get_customer()
+		doc.link_address()
+
 @frappe.whitelist()
 def apply_shipping_rule(shipping_rule):
 	quotation = _get_cart_quotation()
diff --git a/erpnext/stock/utils.py b/erpnext/stock/utils.py
index 0d95c58..3f9de86 100644
--- a/erpnext/stock/utils.py
+++ b/erpnext/stock/utils.py
@@ -92,6 +92,9 @@
 def get_incoming_rate(args):
 	"""Get Incoming Rate based on valuation method"""
 	from erpnext.stock.stock_ledger import get_previous_sle
+	
+	if isinstance(args, basestring):
+		args = json.loads(args)
 
 	in_rate = 0
 	if (args.get("serial_no") or "").strip():
diff --git a/erpnext/templates/includes/address_row.html b/erpnext/templates/includes/address_row.html
index 717ca75..f6ec819 100644
--- a/erpnext/templates/includes/address_row.html
+++ b/erpnext/templates/includes/address_row.html
@@ -3,7 +3,6 @@
         <h4 class="strong">{{ doc.address_title }}</h4>
         <p class="text-muted small">
             {{ frappe.get_doc(doc).get_display() }}
-        </div>
-    </div>
+        </p>
     </a>
 </div>
diff --git a/erpnext/utilities/doctype/address/address.py b/erpnext/utilities/doctype/address/address.py
index a482891..da529fb 100644
--- a/erpnext/utilities/doctype/address/address.py
+++ b/erpnext/utilities/doctype/address/address.py
@@ -10,6 +10,9 @@
 from frappe.model.document import Document
 
 class Address(Document):
+	def __setup__(self):
+		self.flags.linked = False
+
 	def autoname(self):
 		if not self.address_title:
 			self.address_title = self.customer \
@@ -42,13 +45,10 @@
 
 	def link_address(self):
 		"""Link address based on owner"""
-		linked = False
-		for fieldname in self.link_fields:
-			if self.get(fieldname):
-				linked = True
-				break
+		if not self.flags.linked:
+			self.check_if_linked()
 
-		if not linked:
+		if not self.flags.linked:
 			contact = frappe.db.get_value("Contact", {"email_id": self.owner},
 				("name", "customer", "supplier"), as_dict = True)
 			if contact:
@@ -57,6 +57,11 @@
 
 			self.lead = frappe.db.get_value("Lead", {"email_id": self.owner})
 
+	def check_if_linked(self):
+		for fieldname in self.link_fields:
+			if self.get(fieldname):
+				self.flags.linked = True
+				break
 
 	def validate_shipping_address(self):
 		"""Validate that there can only be one shipping address for particular customer, supplier"""
diff --git a/setup.py b/setup.py
index 66d4dcc..56c5b7d 100644
--- a/setup.py
+++ b/setup.py
@@ -1,6 +1,6 @@
 from setuptools import setup, find_packages
 
-version = "6.12.3"
+version = "6.12.4"
 
 with open("requirements.txt", "r") as f:
 	install_requires = f.readlines()