From 90fc3aff724a468b994eb1ea24b758e9bb28a91f Mon Sep 17 00:00:00 2001 From: Govind S Menokee Date: Tue, 16 Jul 2019 01:48:35 +0530 Subject: [PATCH] feat: add patch for default batch_size for old records --- erpnext/patches.txt | 1 + .../patches/v12_0/set_default_batch_size.py | 20 +++++++++++++++++++ 2 files changed, 21 insertions(+) create mode 100644 erpnext/patches/v12_0/set_default_batch_size.py diff --git a/erpnext/patches.txt b/erpnext/patches.txt index 72db8ad063..f357b3d968 100644 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -615,3 +615,4 @@ erpnext.patches.v11_1.set_missing_opportunity_from erpnext.patches.v12_0.set_quotation_status erpnext.patches.v12_0.set_priority_for_support erpnext.patches.v12_0.delete_priority_property_setter +erpnext.patches.v12_0.set_default_batch_size diff --git a/erpnext/patches/v12_0/set_default_batch_size.py b/erpnext/patches/v12_0/set_default_batch_size.py new file mode 100644 index 0000000000..76a355bcf2 --- /dev/null +++ b/erpnext/patches/v12_0/set_default_batch_size.py @@ -0,0 +1,20 @@ +import frappe + + +def execute(): + frappe.reload_doc("manufacturing", "doctype", "bom_operation") + frappe.reload_doc("manufacturing", "doctype", "work_order_operation") + + frappe.db.sql(""" + UPDATE + `tabBOM Operation` bo + SET + bo.batch_size = 1 + """) + frappe.db.sql(""" + UPDATE + `tabWork Order Operation` wop + SET + wop.batch_size = 1 + """) + frappe.db.commit()