brotherton-erpnext/erpnext/patches/v5_2/change_item_selects_to_checks.py
Anand Doshi 01de945388 [cleanup] Removed 'Is Service Item' checkbox and filters
'Is Service Item' checkbox only worked for filtering Items in Maintenance Schedule and Maintenance Visit, and validating that Items in a Maintenance type Order were of type 'Service'. However, it doesn't fit an actual use case where any Sales Item could be given for Maintenance, making the checkbox an unnecessary addition.
2016-01-26 16:22:51 +05:30

22 lines
605 B
Python

from __future__ import unicode_literals
import frappe
def execute():
fields = ("is_stock_item", "is_asset_item", "has_batch_no", "has_serial_no",
"is_purchase_item", "is_sales_item", "inspection_required",
"is_pro_applicable", "is_sub_contracted_item")
# convert to 1 or 0
update_str = ", ".join(["`{0}`=if(`{0}`='Yes',1,0)".format(f) for f in fields])
frappe.db.sql("update tabItem set {0}".format(update_str))
frappe.db.commit()
# alter fields to int
for f in fields:
frappe.db.sql("alter table tabItem change {0} {0} int(1) default '0'".format(f, f))
frappe.reload_doctype("Item")