I want to restrict Purchase Invoices to be submitted without a Supplier Inoivce No. (bill_no). However I’d want this restriction only affect Submit , not affect the Save action. So we can create draft Purchase Invoice even if we have no bill_no information available yet.
I have checked the “Supplier Invoice No.” field as Mandatory via Customize Form, but this restricts saving Invoices also.
Is there a way to only apply the restriction to the Submit, but not the Save action?
throws this error at me as soon I say “New Purchase Invoice”
SyntaxError: Invalid or unexpected token
at init.setup (http://ip.address/assets/js/form.min.js?ver=1553106235.0:1:60054)
at _f.Frm.setup (http://ip.address/assets/js/form.min.js?ver=1553106235.0:1:13114)
at _f.Frm.refresh (http://ip.address/assets/js/form.min.js?ver=1553106235.0:1:19032)
at frappe.views.FormFactory.load (http://ip.address/assets/js/form.min.js?ver=1553106235.0:1:11600)
at Object.callback (http://ip.address/assets/js/desk.min.js?ver=1553106235.0:1:115034)
at Object.success [as success_callback] (http://10.19.225.137/assets/js/desk.min.js?ver=1553106235.0:1:49056)
at 200 (http://ip.address/assets/js/desk.min.js?ver=1553106235.0:1:49424)
at Object. (http://ip.address/assets/js/desk.min.js?ver=1553106235.0:1:51916)
at i (http://ip.address/assets/frappe/js/lib/jquery/jquery.min.js:2:27151)
@adnan Please don’t feel obliged to debug this for me (even though you are most welcome to). I put this here mainly as a reference so I can come back to this at some point
(with ‘good’ double quotes) works like a charm. That being said … the “Mandatory” in the bill_no field needs to be not checked now. The script does the job (blocking “Submit”) by itself.
@adnan: I think this may have happened because you put the code as regular text in here.
3 back ticks (`) above and 2 back ticks below such a code snippet formats the text in between as block of code here in the discourse forun, which may have prevented the encoding properties of the double quotes
I really think this should be a field option so that everyone can easily use it. It’s an essential feature especially for managing longer forms; users should be able to save forms as they go along and only get an error message when they try to Submit. So basically, there should be 2 options for ‘Mandatory’ in every field: