advance paid should not be copied and patch to fix affected records

This commit is contained in:
Nabin Hait 2015-04-28 13:00:23 +05:30
parent 67fdbcf242
commit 042f86e555
4 changed files with 19 additions and 3 deletions

View File

@ -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",

View File

@ -145,4 +145,5 @@ erpnext.patches.v5_0.execute_on_doctype_update
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
erpnext.patches.v5_0.update_temporary_account
erpnext.patches.v5_0.update_advance_paid

View File

@ -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()

View File

@ -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",