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

View File

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