In a custom app I have a field with fieldtype button. And I want to add action to it. I want to run a method then return a value to fill a data field and check the checkbox when the button pressed.
To my understanding there are 3 options:
Server script: using the button options I can connect it to a method on doctype_name.py file.
Client script: using doctype_name.js directly add action to the button.
Both: using js to make frappe.call to server method and return the action.
But using #1 I can’t check the box and fill the data field.
Using #2 I can’t run the server method.
Using #3, the frappe.call method path is not recognized because the py file is in the same doctype directory.
#1 using the server script, I don’t know how to change the display of checked checkbox after setting the value to 1.
#3 using the js to catch the button click and send it to py code via frappe call. But since the doctype_name.py file is in the doctype directory (in app/app/doctype/doctype_name.py) I don’t know how to write the path because frappe doesn’t recognize a py file in doctype directory of a custom app.
I have a fieldtype button which I process the method directly in py file of the doctype. Not in js.
But since I want to change the hidden/show of other fields, I need to do it in js, right?
Is there a way to change field property directly from py?
As my initial post, there are 3 ways to link method to button. Each has their own limitation (as I know, and I’m not a developer )
So the last post of mine was in related to calling a py method from frappe.call(), where that method is inside a class. So it can return a value to js to change the field property.