From d36092d448f3d87fabe67b1d5ed729c1786c9d2a Mon Sep 17 00:00:00 2001 From: Saqib Ansari Date: Wed, 19 Jan 2022 18:27:19 +0530 Subject: [PATCH] patch: set default asset quantity as 1 --- erpnext/patches.txt | 3 ++- erpnext/patches/v13_0/update_asset_quantity_field.py | 8 ++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 erpnext/patches/v13_0/update_asset_quantity_field.py diff --git a/erpnext/patches.txt b/erpnext/patches.txt index fa62b7fc27..2fa668e84f 100644 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -326,4 +326,5 @@ erpnext.patches.v13_0.agriculture_deprecation_warning erpnext.patches.v14_0.delete_agriculture_doctypes erpnext.patches.v13_0.update_exchange_rate_settings erpnext.patches.v14_0.rearrange_company_fields -erpnext.patches.v14_0.update_leave_notification_template \ No newline at end of file +erpnext.patches.v14_0.update_leave_notification_template +erpnext.patches.v13_0.update_asset_quantity_field \ No newline at end of file diff --git a/erpnext/patches/v13_0/update_asset_quantity_field.py b/erpnext/patches/v13_0/update_asset_quantity_field.py new file mode 100644 index 0000000000..47884d1968 --- /dev/null +++ b/erpnext/patches/v13_0/update_asset_quantity_field.py @@ -0,0 +1,8 @@ +import frappe + + +def execute(): + if frappe.db.count('Asset'): + frappe.reload_doc("assets", "doctype", "Asset") + asset = frappe.qb.DocType('Asset') + frappe.qb.update(asset).set(asset.asset_quantity, 1).run() \ No newline at end of file