From 88a37c17a6db4b7a9dd0ca544f3df1fe8fac9e97 Mon Sep 17 00:00:00 2001 From: Makarand Bauskar Date: Thu, 6 Jul 2017 19:13:09 +0530 Subject: [PATCH] [hotfix] commit after every 200 production orders (#9674) --- erpnext/patches/v8_0/update_production_orders.py | 10 ++++++---- erpnext/public/js/setup_wizard.js | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/erpnext/patches/v8_0/update_production_orders.py b/erpnext/patches/v8_0/update_production_orders.py index 317aed5e689..06b8ce74c12 100644 --- a/erpnext/patches/v8_0/update_production_orders.py +++ b/erpnext/patches/v8_0/update_production_orders.py @@ -17,9 +17,11 @@ def execute(): pro_orders = frappe.get_all("Production Order", filters={"docstatus": ["!=", 2]}, fields=fields) + count = 0 for p in pro_orders: pro_order = frappe.get_doc("Production Order", p.name) - + count += 1 + # set required items table pro_order.set_required_items() @@ -39,6 +41,6 @@ def execute(): pro_order.db_set("status", status) elif pro_order.status == "Stopped": pro_order.update_reserved_qty_for_production() - - - \ No newline at end of file + + if count % 200 == 0: + frappe.db.commit() \ No newline at end of file diff --git a/erpnext/public/js/setup_wizard.js b/erpnext/public/js/setup_wizard.js index 31bcfe750c9..43b45d91bc3 100644 --- a/erpnext/public/js/setup_wizard.js +++ b/erpnext/public/js/setup_wizard.js @@ -183,7 +183,7 @@ var erpnext_slides = [ slide.get_input("fy_start_date").on("change", function () { var start_date = slide.form.fields_dict.fy_start_date.get_value(); var year_end_date = - frappe.datetime.add_days(frappe.datetime.add_months(frappe.datetime.user_to_obj(start_date), 12), -1); + frappe.datetime.add_days(frappe.datetime.add_months(start_date, 12), -1); slide.form.fields_dict.fy_end_date.set_value(year_end_date); }); }