ERPNext Foundation ERPNext Cloud User Manual Blog Discuss Frappé* Donate

Custom script for POS


#1

hello, i have a custom script which works fine on the sales invoice i wrote a script where you can fill the total without the tax , the amount of tax and the total with tax.
frappe.ui.form.on("Sales Invoice","validate", function(){
i replaced validate with on_submit still the same
so basically on the save these fields are filled with the correct number that’s if you go and create a sales invoice.
If i go to POS section and i do the invoice from there , and press on submit , it doesn’t show these fields that i mentioned cz there is no save , only submit directly , the fields remain empty
Can anyone help me with this issue?


#2

Currently POS not supports for the custom script.


#3

Thanks for the answer! but isn’t it like when you submit from POS , the invoice number from POS is shown in the sales invoice section so the custom script should be on the sales invoice doctype section right ? as i mentioned on top .
Right now i have an issue which is my items are already imported as selling price no cost price , so it’s included with the tax, so to be able to retrieve the tax, i did custom field called totalht(total wihout tax), total ttc(total with tax) and vat (which is the tax), and i retrieve through the custom scripts the values inside of it,
Is it a way to retrieve the values from POS other than custom script ?


#4

okay so we fixed the problem and it was in this way :
we changed the sql query (the fields that needed a value were given a formula through select case query
as for the doctype sales invoice as it doesn’t change the extra fields from POS as mentioned above,
we changed the trigger frappe.ui.form.on("Sales Invoice","onload", function(){
instead of validate , so if somebody ever wants to see the added values he just need to click on the invoice and it will load them inside the custom fields and he can see them through the report too ofc with the help of select case not of onload trigger (PS:onload doesn’t store them in the DB , it just show them in the custom fields)