chore: patch fixes

This commit is contained in:
Saurabh
2021-12-29 12:39:53 +05:30
parent 493af62038
commit 8b5b146f6d
2 changed files with 19 additions and 9 deletions

View File

@@ -3,14 +3,22 @@ import frappe
def execute(): def execute():
#handle type casting for is_cancelled field
for doc_mapper in (('stock','Stock Ledger Entry'),
('stock','Serial No'),
('accounts','GL Entry')):
try: try:
frappe.db.sql("UPDATE `tabStock Ledger Entry` SET is_cancelled = 0 where is_cancelled in ('', NULL, 'No')") module = doc_mapper[0]
frappe.db.sql("UPDATE `tabSerial No` SET is_cancelled = 0 where is_cancelled in ('', NULL, 'No')") doctype = doc_mapper[1]
frappe.db.sql("UPDATE `tabStock Ledger Entry` SET is_cancelled = 1 where is_cancelled = 'Yes'") frappe.db.sql('''UPDATE `tab{doctype}` SET is_cancelled =
frappe.db.sql("UPDATE `tabSerial No` SET is_cancelled = 1 where is_cancelled = 'Yes'") CASE
WHEN is_cancelled = 'No' THEN 0
WHEN is_cancelled = 'Yes' THEN 1
ELSE 0
END'''.format(doctype=doctype))
frappe.reload_doc("stock", "doctype", "stock_ledger_entry") frappe.reload_doc(module, "doctype", frappe.scrub(doctype))
frappe.reload_doc("stock", "doctype", "serial_no")
except Exception: except Exception:
pass pass

View File

@@ -13,4 +13,6 @@ def execute():
row.item_code = web_item row.item_code = web_item
homepage.flags.ignore_mandatory = True homepage.flags.ignore_mandatory = True
homepage.flags.ignore_links = True
homepage.save() homepage.save()