refactor!: change "is_subcontracted" field type from "Select" to "Check"

This commit is contained in:
Sagar Sharma
2022-03-31 19:57:42 +05:30
parent 02dab021c6
commit d074c93ac7
41 changed files with 119 additions and 96 deletions

View File

@@ -0,0 +1,26 @@
# Copyright (c) 2022, Frappe Technologies Pvt. Ltd. and contributors
# For license information, please see license.txt
import frappe
def execute():
for doctype in ["Purchase Order", "Purchase Receipt", "Purchase Invoice", "Supplier Quotation"]:
frappe.db.sql(
"""
UPDATE `tab{doctype}`
SET is_subcontracted = 0
where is_subcontracted in ('', NULL, 'No')""".format(
doctype=doctype
)
)
frappe.db.sql(
"""
UPDATE `tab{doctype}`
SET is_subcontracted = 1
where is_subcontracted = 'Yes'""".format(
doctype=doctype
)
)
frappe.reload_doc(frappe.get_meta(doctype).module, "doctype", frappe.scrub(doctype))