mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-24 23:49:19 +00:00
refactor: dont ignore dangerous exceptions in patches
This commit is contained in:
@@ -4,20 +4,18 @@ import frappe
|
|||||||
|
|
||||||
def execute():
|
def execute():
|
||||||
#handle type casting for is_cancelled field
|
#handle type casting for is_cancelled field
|
||||||
|
module_doctypes = (
|
||||||
|
('stock', 'Stock Ledger Entry'),
|
||||||
|
('stock', 'Serial No'),
|
||||||
|
('accounts', 'GL Entry')
|
||||||
|
)
|
||||||
|
|
||||||
for doc_mapper in (('stock','Stock Ledger Entry'),
|
for module, doctype in module_doctypes:
|
||||||
('stock','Serial No'),
|
if frappe.db.has_column(doctype, "is_cancelled"):
|
||||||
('accounts','GL Entry')):
|
|
||||||
try:
|
|
||||||
module = doc_mapper[0]
|
|
||||||
doctype = doc_mapper[1]
|
|
||||||
|
|
||||||
frappe.db.sql('''UPDATE `tab{doctype}` SET is_cancelled = CASE
|
frappe.db.sql('''UPDATE `tab{doctype}` SET is_cancelled = CASE
|
||||||
WHEN is_cancelled = 'No' THEN 0
|
WHEN is_cancelled = 'No' THEN 0
|
||||||
WHEN is_cancelled = 'Yes' THEN 1
|
WHEN is_cancelled = 'Yes' THEN 1
|
||||||
ELSE 0
|
ELSE 0
|
||||||
END'''.format(doctype=doctype))
|
END'''.format(doctype=doctype))
|
||||||
|
|
||||||
frappe.reload_doc(module, "doctype", frappe.scrub(doctype))
|
frappe.reload_doc(module, "doctype", frappe.scrub(doctype))
|
||||||
except Exception:
|
|
||||||
pass
|
|
||||||
|
|||||||
Reference in New Issue
Block a user