Is it possible to set ignore_validate = True;
in JS? Say Custom Script?
Not out of the box. Ignoring validations is not a good idea
@saurabh6790 agreed its not the best idea but say for this use case:
In Sales Order there is a field called Customer Purchase Order, I would like to make this field editable after Submit but unfortunately this is a standard field.
Furthermore if I try to force it via a simple set_df_property
the validation stops it.
So am thinking of ways around this.
Any good ideas?
if you want that field to be editable after submit, go to the doctype and customize form, find the field and edit it, check allow on submit
@johnskywalker yes thats the correct way but this only works for custom fields, you cannot set allow on submit for standard fields. Thanks for trying though
For standard fields we gotta bypass the validation checks i suppose, just trying to find a way to do that.
you can actually do that also in standard fields just go to customize form, try doing it in your local first and commit>push it to your prod/live
ok sorry, I think you should do doc_events. You create a python file
def your_method(doc,method):
doc.name = “hello world”
edit your hooks.py
look for doc_events, and edit
ex.
doc_events = {
“*”: {
“on_update”: “path.to.your_method”,
}
}
for full documentation https://frappe.github.io/frappe/user/en/guides/basics/hooks
now you just have to pick the right doc_event
@johnskywalker Thanks for sharing, i know its possible via python, just wondering if there was a neat way to do it via JS.
Hi @johnskywalker, can you give some help, I have my app and the erpnext, and I want to overwrite a function of erpnext without change the code of erpnext, not overwrite just that the validation of erpnext doesn’t work and the function of my app work; for Example this is my app hooks.py:
doc_events = {
“doctype”: {
“validate”: “myapp.path.validate_qty”
}
}
and this my doc.py with the function
from future import unicode_literals
import frappe
from frappe import msgprint
def validate_qty(self, method):
if not 5 > 6:
frappe.throw(_(“test”))
this validation just work if I erase the function of erpnext. Thanks for any help.
hello @Thiago_Henry you have mentioned if I erase the function of erpnext
which function are you saying?
@johnskywalker noo john not you hehe I mentioned that my function that are in my hooks.py just work if I erase the function of erpnext and I want to know if you know some way that I don’t need change the code of erpnext just change the code of my app.
Thanks for reply
hi yes I get it. What I am saying is which line are you getting an error?