Hello!
There is a way to prevent a button field (button field type) do not disappear when the doctype is validated?
I don’t know if it is the desired behavior or a bug (that the button disappears on submission), due we can set
"depends_on": "eval:doc.docstatus===1"
to hide the button on validated documents.
Thanks
If this is in an app doctype, try it as a customized field instead.
Customized fields don’t obey docstatus rules, which can be leveraged nicely.
If this is in a ERPNext doctype, share some code and we’ll see what we can solve.
@tmatteson Thanks for your anwser.
It’s a Custom Doctype.
I’ve just tried with customizing field but the behavior is the same when the document is validated the button disappears.
A couple of further questions:
Is there any depends_on
logic that you may have overlooked?
Is there a custom script that may be setting it to hide unintentionally?
Are you opposed to injecting a custom script to ensure that it is not hidden when docstatus == 1?
This seems solvable but a little odd.
@tmatteson
Answering your questions:
Is there any depends_on logic that you may have overlooked?
There isn’t
Is there a custom script that may be setting it to hide unintentionally?
There is but doesn’t have any code that can hide the button
Are you opposed to injecting a custom script to ensure that it is not hidden when docstatus == 1?
I’ve tried to do this but without success
In order to isolate the problem, I’ve made a new custom DocType with only a button and nothing more, not depends_on nor a custom script that could be changing the behavior and It seems that the “hide behavior” is by default.
Thanks again for your help
What trigger are you using to unhide? I think you probably want on_update_after_submit
but you may have to try a few of them, (scroll to 'list of events", about halfway down).
Hello Tyler,
The hooks that you points off are server side, I can’t see how these scripts would unhide the button in the frontend.
Try:
cur_frm.set_df_property("custom_button", "hidden", false);
1 Like