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

This commit is contained in:
Nabin Hait 2015-04-27 11:24:18 +05:30
parent 3b8682f534
commit 3c3855ac8c
4 changed files with 18 additions and 2 deletions

View File

@ -389,6 +389,7 @@
"fieldname": "advance_paid",
"fieldtype": "Currency",
"label": "Advance Paid",
"no_copy": 1,
"permlevel": 0,
"print_hide": 1,
"read_only": 1
@ -775,7 +776,7 @@
"icon": "icon-file-text",
"idx": 1,
"is_submittable": 1,
"modified": "2014-11-27 17:27:38.839440",
"modified": "2015-04-27 13:40:17.589085",
"modified_by": "Administrator",
"module": "Buying",
"name": "Purchase Order",

View File

@ -98,3 +98,4 @@ erpnext.patches.v4_2.repost_reserved_qty
erpnext.patches.v4_2.repost_sle_for_si_with_no_warehouse
erpnext.patches.v4_2.fix_recurring_orders
erpnext.patches.v4_2.delete_gl_entries_for_cancelled_invoices
erpnext.patches.v4_2.update_advance_paid

View File

@ -0,0 +1,13 @@
# Copyright (c) 2013, Web Notes 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

@ -549,6 +549,7 @@
"fieldname": "advance_paid",
"fieldtype": "Currency",
"label": "Advance Paid",
"no_copy": 1,
"options": "Company:company:default_currency",
"permlevel": 0,
"print_hide": 1,
@ -1033,7 +1034,7 @@
"idx": 1,
"is_submittable": 1,
"issingle": 0,
"modified": "2015-01-12 15:16:51.611467",
"modified": "2015-04-27 13:39:50.229026",
"modified_by": "Administrator",
"module": "Selling",
"name": "Sales Order",