From af3e807607ccb994e45919f967d4955e011a7915 Mon Sep 17 00:00:00 2001 From: anandbaburajan Date: Thu, 30 Mar 2023 15:28:59 +0530 Subject: [PATCH] chore: auto fill asset name and available for use date --- erpnext/assets/doctype/asset/asset.js | 3 +++ erpnext/assets/doctype/asset/asset.json | 5 ++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/erpnext/assets/doctype/asset/asset.js b/erpnext/assets/doctype/asset/asset.js index 49513851361a..b9f16a795a9e 100644 --- a/erpnext/assets/doctype/asset/asset.js +++ b/erpnext/assets/doctype/asset/asset.js @@ -466,6 +466,9 @@ frappe.ui.form.on('Asset', { } else { frm.set_value('purchase_date', purchase_doc.posting_date); } + if (!frm.doc.is_existing_asset && !frm.doc.available_for_use_date) { + frm.set_value('available_for_use_date', frm.doc.purchase_date); + } const item = purchase_doc.items.find(item => item.item_code === frm.doc.item_code); if (!item) { doctype_field = frappe.scrub(doctype) diff --git a/erpnext/assets/doctype/asset/asset.json b/erpnext/assets/doctype/asset/asset.json index ea575fd71f1b..a1e8f331cdf7 100644 --- a/erpnext/assets/doctype/asset/asset.json +++ b/erpnext/assets/doctype/asset/asset.json @@ -79,6 +79,9 @@ "options": "ACC-ASS-.YYYY.-" }, { + "depends_on": "item_code", + "fetch_from": "item_code.item_name", + "fetch_if_empty": 1, "fieldname": "asset_name", "fieldtype": "Data", "in_list_view": 1, @@ -517,7 +520,7 @@ "table_fieldname": "accounts" } ], - "modified": "2023-02-02 00:03:11.706427", + "modified": "2023-03-30 15:07:41.542374", "modified_by": "Administrator", "module": "Assets", "name": "Asset",