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

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