From ddd2648c1ec781698bf54527c2f8201438b9e4bf Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Mon, 30 Jun 2014 18:08:07 +0530 Subject: [PATCH 1/3] fix travis, build website before tests --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index dba0dab6ecf..7e5f21d48a8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -27,5 +27,6 @@ script: - frappe --reinstall - frappe --install_app erpnext --verbose - frappe -b + - frappe --build_website - frappe --serve_test & - frappe --verbose --run_tests --app erpnext From c53efc0d6c9d154feb4efd039e3017efce67b0d5 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Tue, 1 Jul 2014 17:51:34 +0530 Subject: [PATCH 2/3] fix status_updater - update delivery status in Sales Order from Sales Invoice --- erpnext/controllers/status_updater.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/erpnext/controllers/status_updater.py b/erpnext/controllers/status_updater.py index 9322ca6aa64..90eacd98206 100644 --- a/erpnext/controllers/status_updater.py +++ b/erpnext/controllers/status_updater.py @@ -183,10 +183,10 @@ class StatusUpdater(Document): args['second_source_condition'] = "" if args.get('second_source_dt') and args.get('second_source_field') \ and args.get('second_join_field'): - args['second_source_condition'] = """ + (select sum(%(second_source_field)s) + args['second_source_condition'] = """ + ifnull((select sum(%(second_source_field)s) from `tab%(second_source_dt)s` where `%(second_join_field)s`="%(detail_id)s" - and (docstatus=1))""" % args + and (docstatus=1)), 0)""" % args if args['detail_id']: frappe.db.sql("""update `tab%(target_dt)s` From 5f42276dbdf1b348727d4d45844e77cc2813b220 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Tue, 1 Jul 2014 18:08:37 +0530 Subject: [PATCH 3/3] added patch for fixing sales order delivered qty --- erpnext/patches.txt | 1 + .../v4_1/fix_sales_order_delivered_status.py | 15 +++++++++++++++ 2 files changed, 16 insertions(+) create mode 100644 erpnext/patches/v4_1/fix_sales_order_delivered_status.py diff --git a/erpnext/patches.txt b/erpnext/patches.txt index e9ba56b38f2..53ab7b5e93c 100644 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -66,3 +66,4 @@ erpnext.patches.v4_0.set_pricing_rule_for_buying_or_selling erpnext.patches.v4_0.set_naming_series_property_setter erpnext.patches.v4_1.set_outgoing_email_footer erpnext.patches.v4_1.fix_jv_remarks +erpnext.patches.v4_1.fix_sales_order_delivered_status diff --git a/erpnext/patches/v4_1/fix_sales_order_delivered_status.py b/erpnext/patches/v4_1/fix_sales_order_delivered_status.py new file mode 100644 index 00000000000..f66d85657da --- /dev/null +++ b/erpnext/patches/v4_1/fix_sales_order_delivered_status.py @@ -0,0 +1,15 @@ +# 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 si in frappe.db.sql_list("""select name + from `tabSales Invoice` + where ifnull(update_stock,0) = 1 and docstatus = 1 and exists( + select name from `tabSales Invoice Item` where parent=`tabSales Invoice`.name and + ifnull(so_detail, "") != "")"""): + + invoice = frappe.get_doc("Sales Invoice", si) + invoice.update_qty()