in locations:
/home/frappe/frappe-bench/sites/[site-name]/public/js/poscoz.js
/home/frappe/frappe-bench/sites/assets/js/poscoz.js FYI: this simple code is working in POS console.
I tried multiple locations as you see but the “poscoz.js” file is nowhere to be found in poinf-of-sale page source, nor the js effect.
I don’t know if I should restart/reload bench after adding a hook or not, the docs didn’t mention anything about that.
Another failed approach is to use app_include_js = "assets/js/pos_extension.js"
pos_extension.js:
consloe.log('test')
it seems to work at first sight, but another error comes up:
TypeError: Cannot read property 'extend' of undefined
at eval (eval at setup (form.min.js?ver=1614286080.0:1), <anonymous>:386:67)
at init.setup (form.min.js?ver=1614286080.0:1)
at frappe.ui.form.Form.setup (form.min.js?ver=1614286080.0:1)
at frappe.ui.form.Form.refresh (form.min.js?ver=1614286080.0:1)
at get_frm (<anonymous>:603:8)
at <anonymous>:593:17
at Object.callback (desk.min.js?ver=1614286080.0:1)
at Object.success [as success_callback] (desk.min.js?ver=1614286080.0:1)
at 200 (desk.min.js?ver=1614286080.0:1)
at Object.<anonymous> (desk.min.js?ver=1614286080.0:1)
still don’t know how to use page_js{"page-name": "location"} properly
Update: I had to edit point-of-sale.js in frappe-bench/apps/erpnext/selling/page/point-of-sale.js because I had no idea how to override it using hooks.py.
Of course I missed everything up on the first try and I had to wipe the vps clean and reinatall it all over again, but here we go.
I wish the docs were a bit clearer on the hooks matter.