advance paid should not be copied and patch to fix affected records
diff --git a/erpnext/buying/doctype/purchase_order/purchase_order.json b/erpnext/buying/doctype/purchase_order/purchase_order.json
index cd652fe..b985a06 100644
--- a/erpnext/buying/doctype/purchase_order/purchase_order.json
+++ b/erpnext/buying/doctype/purchase_order/purchase_order.json
@@ -508,6 +508,7 @@
"fieldname": "advance_paid",
"fieldtype": "Currency",
"label": "Advance Paid",
+ "no_copy": 1,
"permlevel": 0,
"print_hide": 1,
"read_only": 1
@@ -872,7 +873,7 @@
"icon": "icon-file-text",
"idx": 1,
"is_submittable": 1,
- "modified": "2015-03-23 14:47:26.072237",
+ "modified": "2015-04-28 15:27:28.755816",
"modified_by": "Administrator",
"module": "Buying",
"name": "Purchase Order",
diff --git a/erpnext/patches.txt b/erpnext/patches.txt
index 4acb6dc..df2c694 100644
--- a/erpnext/patches.txt
+++ b/erpnext/patches.txt
@@ -145,4 +145,5 @@
erpnext.patches.v4_2.fix_recurring_orders
erpnext.patches.v4_2.delete_gl_entries_for_cancelled_invoices
erpnext.patches.v5_0.project_costing
-erpnext.patches.v5_0.update_temporary_account
\ No newline at end of file
+erpnext.patches.v5_0.update_temporary_account
+erpnext.patches.v5_0.update_advance_paid
\ No newline at end of file
diff --git a/erpnext/patches/v5_0/update_advance_paid.py b/erpnext/patches/v5_0/update_advance_paid.py
new file mode 100644
index 0000000..74e71e8
--- /dev/null
+++ b/erpnext/patches/v5_0/update_advance_paid.py
@@ -0,0 +1,13 @@
+# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
+# License: GNU General Public License v3. See license.txt
+
+from __future__ import unicode_literals
+import frappe
+
+def execute():
+ for dt in ("Sales Order", "Purchase Order"):
+ orders_with_advance = frappe.db.sql("""select name from `tab{0}`
+ where docstatus < 2 and ifnull(advance_paid, 0) != 0""".format(dt), as_dict=1)
+
+ for order in orders_with_advance:
+ frappe.get_doc(dt, order.name).set_total_advance_paid()
\ No newline at end of file
diff --git a/erpnext/selling/doctype/sales_order/sales_order.json b/erpnext/selling/doctype/sales_order/sales_order.json
index e627824..553064c 100644
--- a/erpnext/selling/doctype/sales_order/sales_order.json
+++ b/erpnext/selling/doctype/sales_order/sales_order.json
@@ -595,6 +595,7 @@
"fieldname": "advance_paid",
"fieldtype": "Currency",
"label": "Advance Paid",
+ "no_copy": 1,
"options": "Company:company:default_currency",
"permlevel": 0,
"print_hide": 1,
@@ -1079,7 +1080,7 @@
"idx": 1,
"is_submittable": 1,
"issingle": 0,
- "modified": "2015-03-23 14:46:09.478285",
+ "modified": "2015-04-28 15:27:40.852414",
"modified_by": "Administrator",
"module": "Selling",
"name": "Sales Order",