From bc408d8d0b929f88ab40ccdb3564a7776fb30d9f Mon Sep 17 00:00:00 2001 From: nabinhait Date: Mon, 7 Jul 2014 16:51:52 +0530 Subject: [PATCH 1/3] Run trigger of company field on onload function, even if company exists --- erpnext/public/js/transaction.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/erpnext/public/js/transaction.js b/erpnext/public/js/transaction.js index a4b1abbb6a..3c99ced701 100644 --- a/erpnext/public/js/transaction.js +++ b/erpnext/public/js/transaction.js @@ -20,13 +20,18 @@ erpnext.TransactionController = erpnext.stock.StockController.extend({ currency: currency, price_list_currency: currency, status: "Draft", - company: frappe.defaults.get_user_default("company"), fiscal_year: frappe.defaults.get_user_default("fiscal_year"), is_subcontracted: "No", }, function(fieldname, value) { if(me.frm.fields_dict[fieldname] && !me.frm.doc[fieldname]) me.frm.set_value(fieldname, value); }); + + if(!this.frm.doc.company) { + this.frm.set_value("company", frappe.defaults.get_user_default("company")); + } else { + cur_frm.script_manager.trigger("company"); + } } if(this.other_fname) { From 2c0c66e7560821d41baa250c31f456f118e522dc Mon Sep 17 00:00:00 2001 From: nabinhait Date: Mon, 7 Jul 2014 17:56:11 +0530 Subject: [PATCH 2/3] Update delivery and billing status in SO --- erpnext/patches.txt | 1 + .../fix_delivery_and_billing_status_for_draft_so.py | 12 ++++++++++++ erpnext/selling/doctype/sales_order/sales_order.json | 6 +++--- 3 files changed, 16 insertions(+), 3 deletions(-) create mode 100644 erpnext/patches/v4_1/fix_delivery_and_billing_status_for_draft_so.py diff --git a/erpnext/patches.txt b/erpnext/patches.txt index 53ab7b5e93..1c2112d7b8 100644 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -67,3 +67,4 @@ 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 +erpnext.patches.v4_1.fix_delivery_and_billing_status_for_draft_so \ No newline at end of file diff --git a/erpnext/patches/v4_1/fix_delivery_and_billing_status_for_draft_so.py b/erpnext/patches/v4_1/fix_delivery_and_billing_status_for_draft_so.py new file mode 100644 index 0000000000..85e2e4c06a --- /dev/null +++ b/erpnext/patches/v4_1/fix_delivery_and_billing_status_for_draft_so.py @@ -0,0 +1,12 @@ +# 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(): + frappe.db.sql("""update `tabSales Order` set delivery_status = 'Not Delivered' + where delivery_status = 'Delivered' and ifnull(per_delivered, 0) = 0""") + + frappe.db.sql("""update `tabSales Order` set billing_status = 'Not Billed' + where billing_status = 'Billed' and ifnull(per_billed, 0) = 0""") \ 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 77e7887425..ebe1d84eda 100644 --- a/erpnext/selling/doctype/sales_order/sales_order.json +++ b/erpnext/selling/doctype/sales_order/sales_order.json @@ -762,7 +762,7 @@ "hidden": 1, "label": "Delivery Status", "no_copy": 1, - "options": "Fully Delivered\nNot Delivered\nPartly Delivered\nClosed\nNot Applicable", + "options": "Not Delivered\nFully Delivered\nPartly Delivered\nClosed\nNot Applicable", "permlevel": 0, "print_hide": 1 }, @@ -809,7 +809,7 @@ "hidden": 1, "label": "Billing Status", "no_copy": 1, - "options": "Fully Billed\nNot Billed\nPartly Billed\nClosed", + "options": "Not Billed\nFully Billed\nPartly Billed\nClosed", "permlevel": 0, "print_hide": 1 }, @@ -883,7 +883,7 @@ "idx": 1, "is_submittable": 1, "issingle": 0, - "modified": "2014-07-04 17:16:36.889948", + "modified": "2014-07-07 17:47:40.089520", "modified_by": "Administrator", "module": "Selling", "name": "Sales Order", From 6c40079139e714ff145e0a4adff8c3a537172ef5 Mon Sep 17 00:00:00 2001 From: nabinhait Date: Mon, 7 Jul 2014 18:02:53 +0530 Subject: [PATCH 3/3] Update delivery and billing status in SO --- .../v4_1/fix_delivery_and_billing_status_for_draft_so.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/erpnext/patches/v4_1/fix_delivery_and_billing_status_for_draft_so.py b/erpnext/patches/v4_1/fix_delivery_and_billing_status_for_draft_so.py index 85e2e4c06a..8d38338e04 100644 --- a/erpnext/patches/v4_1/fix_delivery_and_billing_status_for_draft_so.py +++ b/erpnext/patches/v4_1/fix_delivery_and_billing_status_for_draft_so.py @@ -6,7 +6,7 @@ import frappe def execute(): frappe.db.sql("""update `tabSales Order` set delivery_status = 'Not Delivered' - where delivery_status = 'Delivered' and ifnull(per_delivered, 0) = 0""") + where delivery_status = 'Delivered' and ifnull(per_delivered, 0) = 0 and docstatus = 0""") frappe.db.sql("""update `tabSales Order` set billing_status = 'Not Billed' - where billing_status = 'Billed' and ifnull(per_billed, 0) = 0""") \ No newline at end of file + where billing_status = 'Billed' and ifnull(per_billed, 0) = 0 and docstatus = 0""") \ No newline at end of file