From 770d04e63303b832e48d9fde19346af0e7682da9 Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Wed, 5 Oct 2016 23:02:15 +0530 Subject: [PATCH] [Fix] sales order status showing completed, while it's status was to bill --- erpnext/controllers/status_updater.py | 7 +------ erpnext/patches.txt | 1 + .../v7_0/update_status_of_zero_amount_sales_order.py | 7 +++++++ 3 files changed, 9 insertions(+), 6 deletions(-) create mode 100644 erpnext/patches/v7_0/update_status_of_zero_amount_sales_order.py diff --git a/erpnext/controllers/status_updater.py b/erpnext/controllers/status_updater.py index ccbf377901..968e6b8245 100644 --- a/erpnext/controllers/status_updater.py +++ b/erpnext/controllers/status_updater.py @@ -301,12 +301,7 @@ class StatusUpdater(Document): ref_doc = frappe.get_doc(ref_dt, ref_dn) ref_doc.db_set("per_billed", per_billed) - - if frappe.get_meta(ref_dt).get_field("billing_status"): - if per_billed < 0.001: billing_status = "Not Billed" - elif per_billed >= 99.99: billing_status = "Fully Billed" - else: billing_status = "Partly Billed" - ref_doc.db_set('billing_status', billing_status) + ref_doc.set_status(update=True) def get_tolerance_for(item_code, item_tolerance={}, global_tolerance=None): """ diff --git a/erpnext/patches.txt b/erpnext/patches.txt index 9822fc041a..927e2c50f0 100644 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -318,3 +318,4 @@ erpnext.patches.v7_0.set_party_name_in_payment_entry execute:frappe.db.sql("update `tabTimesheet` ts, `tabEmployee` emp set ts.employee_name = emp.employee_name where emp.name = ts.employee and ts.employee_name is null and ts.employee is not null") execute:frappe.db.sql("delete from `tabTimesheet Detail` where NOT EXISTS (select name from `tabTimesheet` where name = `tabTimesheet Detail`.parent)") erpnext.patches.v7_0.update_mode_of_payment_type +erpnext.patches.v7_0.update_status_of_zero_amount_sales_order diff --git a/erpnext/patches/v7_0/update_status_of_zero_amount_sales_order.py b/erpnext/patches/v7_0/update_status_of_zero_amount_sales_order.py new file mode 100644 index 0000000000..9b2b24785a --- /dev/null +++ b/erpnext/patches/v7_0/update_status_of_zero_amount_sales_order.py @@ -0,0 +1,7 @@ +from __future__ import unicode_literals +import frappe + +def execute(): + for data in frappe.get_all('Sales Order', fields = ["name"], filters = [["docstatus", "=", "1"], ["grand_total", "=", "0"]]): + sales_order = frappe.get_doc('Sales Order', data.name) + sales_order.set_status(update=True, update_modified = False) \ No newline at end of file