From d9f31770c659b2da8a69f9a518ae93a2bf68cb8f Mon Sep 17 00:00:00 2001 From: Ankush Menat Date: Tue, 11 Jan 2022 17:22:40 +0530 Subject: [PATCH] fix(patch): enable all uoms on recently created sites (cherry picked from commit f8119563ca51f46917cc521429d61a374b6cbc8a) --- erpnext/patches.txt | 1 + erpnext/patches/v13_0/enable_uoms.py | 13 +++++++++++++ 2 files changed, 14 insertions(+) create mode 100644 erpnext/patches/v13_0/enable_uoms.py diff --git a/erpnext/patches.txt b/erpnext/patches.txt index 2b01c0b8507..18319f70c47 100644 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -331,6 +331,7 @@ erpnext.patches.v13_0.enable_scheduler_job_for_item_reposting erpnext.patches.v13_0.requeue_failed_reposts erpnext.patches.v13_0.fetch_thumbnail_in_website_items erpnext.patches.v13_0.update_job_card_status +erpnext.patches.v13_0.enable_uoms erpnext.patches.v12_0.update_production_plan_status erpnext.patches.v13_0.item_naming_series_not_mandatory erpnext.patches.v13_0.update_category_in_ltds_certificate diff --git a/erpnext/patches/v13_0/enable_uoms.py b/erpnext/patches/v13_0/enable_uoms.py new file mode 100644 index 00000000000..4d3f6376303 --- /dev/null +++ b/erpnext/patches/v13_0/enable_uoms.py @@ -0,0 +1,13 @@ +import frappe + + +def execute(): + frappe.reload_doc('setup', 'doctype', 'uom') + + uom = frappe.qb.DocType("UOM") + + (frappe.qb + .update(uom) + .set(uom.enabled, 1) + .where(uom.creation >= "2021-10-18") # date when this field was released + ).run()