Editing Documents in Custom Workflow

@rmehta Hope all is well with yourself and the great ERPNext team!

While testing a custom workflow it became apparent that the “only allow edit for” field is not being properly applied.

To offer an example, please refer to the below screenshot:

In state 2 of the workflow, only the sales manager should have ability to edit the document, however, this is not the case. The sales user still has full edit ability of the document in state 2. Unfortunately, this inconsistency compromises the workflow process.

After searching this forum, I was able to identify a similar post calling attention to this issue, so I’m sure you may have some background on the topic:

In the post you mentioned you were checking into the coding to identify the issue. Has the core team been able to rectify the bug? If so, is there a planned date to pull in the fix?

In the interim, we have created a Github Issue (5184) to address the situation.
@cpurbaugh

Thanks for your valuable time!

Is this the same issue in Proposed fix to #1690 by MaxMorais · Pull Request #1699 · frappe/frappe · GitHub

Will be great if you can push a fix.

I use the following custom script for the same effect:

frappe.ui.form.on("Sales Order", { validate: function(frm) { if(user!="[AUTHORIZED USER]" && frm.doc.workflow_state=="[WORKFLOW STATE]") { msgprint("[ERROR MESSAGE]"); validated = false; } } });

Not sure if this could be used as part of a fix or not though.

@cpurbaugh can we achieve this using Python?