Allow on Submit

As per the previous discussions that I read I perfectly understand that it is safer not to allow on submit changes on documents.
I understand that this prevents changes that may cause linkage problems between documents and helps to keep track of changes.
As per our experience there are many changes that clients ask for their orders, such as:

  • Delivery Address
  • Correct item descriptions ( if there is a typo )
  • Change delivery date
  • Add something to the order (e.g. catalogue, samples ecc)
  • Add an extra discount when an order is late…
  • Add, change or remove shipping cost if client decides to change shipment …
  • Change taxes if client decide to change destination of an item. ( In EU we have to apply VAT, if we ship outside the EU there is no VAT to apply )

As there is a timeline in every document, we can keep track of every single change already, so only linkage problem remains.

Ok so what if my Sales Order has plenty of linked documents and I need to change delivery address?
Really should I amend every single connected document?

Based on this I think you should add Allow on Submit permission in Role permission Manager.
With this permission a manager can decide which fields can be set “Allow on Submit” without having to create custom fields.

Companies like mine that manufacture on demand have long delivery so there are always many changes to be made during the 2 months from order to delivery.

6 Likes

Any workaround / updates on this ?

You can always use the customisation function and allow the required fields to be set even if submitted:

A global “allow on submit” would basically equal the doctype not being submitted at all…

that is ok. But the use case is to allow a specific role, who can edit a certain field after submit

1 Like

Well, if you want a workaround here’s a solution:

You can create a hook for it (Documents Events) in the hook.py and specify there what you want.

doc_events = {
        "DoctypeName": {
                "on_update": "your_app_name.some_py_file.method_name"
        }
 }

then,

def method_name(doc, handler=None):
        user_roles = frappe.get_roles(frappe.session.user)
        If doc.status == submit AND 'Some Role Here' in user_roles:
                   //do something

Should do the trick.

2 Likes

unfortunately if you’re on a hosted plan you can’t do this.

1 Like

i want to validate a doctype on being submitted based on some condition.
how to do it !?

@jignesh_shah, You can add a workflow on particular doctype so that particular user has the permission to submit the form.

in v13 any breakthrough/suggestion in the below use case ?

case : Expense Claim doctype having workflow, how to allow a specific role (Accounts User) to edit a custom field after submit.

What i did :
gave field level permission to 1 for the custom field

set accounts user role permission for the doctype to 1 for read & write

after docstatus ==1, the accounts user role is unable to edit the field. Only System Manager role is able to edit the field after submit.

Accounts User role already has Only Allow Edit For rights to change at the document state with docstatus 1 in workflow.

I have a perculiar case to this I just posted on my wall this afternoon. Please check it out and tell me how to solve it