How can I run a script on POS Webview event? Like submit or add items to shopping chart?
POS is not a webview but a custom page. And there are no custom events for pages right now.
So it’s not possible hit an API selling products by POS event??
My logic is: when submit a POS using event “on_submit”, hit my ecommerce API updating the stock
Any hint?
please look at this :
I did not understood, just need to run js on a event like:
frappe.ui.form.on("point-of-sale", "refresh", function(){
console.log("worked");
});
It is not working like that, what you do is working just for “doctype” not “page”
Uhum, I understood that. So, can you give me an example how to run a console log on on_load event in a page?
Guys, I’m still stuck on that, if you can show us a example I’ll be grateful.
Found it!
Created a js file in public/js
app folder, following script:
frappe.pages['pos'].refresh = function (wrapper) {
console.log('worked!');
}
Then you have to appoint the js file in hooks.py under "#include js in page"
row, like this:
#include js in page
page_js: {"pos" : "public/js/js_file.js"}
Note: as far I know, you cannot do it on custom_script feature site, cause ‘pos’ it’s a page, not a doctype. So, you can do it just using a app.
Great solution.
Do you know how to do the same in the List (desk#List)?
But not for a spesific list. It is for generic List.
For example for the toolbar in the listview
Thank you