Skip to content

Commit

Permalink
chore: auto fill asset name and available for use date (backport #34660
Browse files Browse the repository at this point in the history
…) (#34662)

* chore: auto fill asset name and available for use date

(cherry picked from commit af3e807)

# Conflicts:
#	erpnext/assets/doctype/asset/asset.json

* Update asset.json

---------

Co-authored-by: anandbaburajan <anandbaburajan@gmail.com>
  • Loading branch information
mergify[bot] and anandbaburajan committed Mar 30, 2023
1 parent bae476c commit 8510c39
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
3 changes: 3 additions & 0 deletions erpnext/assets/doctype/asset/asset.js
Original file line number Diff line number Diff line change
Expand Up @@ -469,6 +469,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)
Expand Down
7 changes: 5 additions & 2 deletions erpnext/assets/doctype/asset/asset.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,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,
Expand Down Expand Up @@ -527,7 +530,7 @@
"table_fieldname": "accounts"
}
],
"modified": "2023-01-25 17:45:48.649543",
"modified": "2023-03-30 15:07:41.542374",
"modified_by": "Administrator",
"module": "Assets",
"name": "Asset",
Expand Down Expand Up @@ -571,4 +574,4 @@
"states": [],
"title_field": "asset_name",
"track_changes": 1
}
}

0 comments on commit 8510c39

Please sign in to comment.