From 3f10e77d9311ead939cb4ed7a83998fad13d207b Mon Sep 17 00:00:00 2001 From: Jordi Albert <63541019+jarg1023@users.noreply.github.com> Date: Mon, 12 Sep 2022 11:01:57 +0200 Subject: [PATCH] #33 | Add new custom js to see all IT Objects fileterd by location --- msp/hooks.py | 2 ++ msp/public/js/location.js | 7 +++++++ 2 files changed, 9 insertions(+) create mode 100644 msp/public/js/location.js diff --git a/msp/hooks.py b/msp/hooks.py index 1a24064..4348ffd 100644 --- a/msp/hooks.py +++ b/msp/hooks.py @@ -39,6 +39,8 @@ jenv = { # doctype_tree_js = {"doctype" : "public/js/doctype_tree.js"} # doctype_calendar_js = {"doctype" : "public/js/doctype_calendar.js"} +doctype_js = {"Location" : "public/js/location.js"} + # Home Pages # ---------- diff --git a/msp/public/js/location.js b/msp/public/js/location.js new file mode 100644 index 0000000..76b5adf --- /dev/null +++ b/msp/public/js/location.js @@ -0,0 +1,7 @@ +frappe.ui.form.on('Location', { + refresh(frm) { + frm.add_custom_button('Show IT Objects in Location', () => { + frappe.set_route('List', 'IT Object', { location_full_path: ['like', `%${frm.doc.location_name}%`] }) + }) + } +});