Sales Order Restriction

Hi,

I have a situation here, I am Having two roles for the employees. 1. Operator 2. TL

Now I want Operator to create the sales order and later on TL to deliver it, but I don’t want to see them the actual client name, item rates, total rates and total sales order value, Which I have already achieved by using the field restriction method.

For fetching the client information I have created a custom field “Client Code” in customer form, so our accounts team is creating the clients fill there information i.e. name, address etc, and Client Code as well and even the items and there prices.

Now the problem is when my Operator puts the Client Code in Sales order form, I believe the information of the clients should be fetched from back end using client code as key, but it is not happening and when I want to create it, I get “Customer. It is needed to fetch Item Details.” Error, so now I want the help, how I can fetch the client details using Client Code and later on use it for billing after the sales order is completed.

And because of this my workflow is also not working, it gives me the error that the Customer details are mandatory.

Your help is highly appreciated.

ok please just to inform us laymen

I looked to find this so does TL refer to Truck Load

So then for eg FTL Full Truck Load and LTL means Less than Truck Load!?

@clarkej Thanks for the reply.

When I say TL it means Team Leader (Team Leader is the role for our employees).

So basically I want my accounts team to create the clients which will include all information with the custom field “Client code” which is created by me, and later on this information will be used to create the Sales Order by Operator and TL where they cannot see the client details like address name etc and not even the rates, but in this case they cannot save or create the sales order, because the Customer name is mandatory in sales order and Customer name TL and Operator cannot see or Select.

Now if I want is to select them a client code while creating sales order where all information will be fetched in background without displaying them in Sales order.

How I can achieve this ?

As far as I know I can create a Filed Type “Link” in custom field creation but I am not able to pull the data from it.

Regards

ok thanks apparently acronyms like LTL FTL are used in road transport industry!

"
As far as I know I can create a Filed Type “Link” in custom field creation but I am not able to pull the data from it.
"

I wonder to pull values maybe you seek Linked Values as in this Library tutorial

https://frappe.io/docs/user/en/tutorial/naming-and-linking

Then control access based on permission levels?

https://erpnext.org/docs/user/manual/en/setting-up/users-and-permissions/role-based-permissions

I don’t code in the trenches - these I know from reading experience…

Thanks @clarkej

From last 4 days I am doing research on the link which you have pointed, and I have created the separate Doctype for Client Code where customers are know to TL am Operators by there client code, not the orignal name.

Even I successfully fetched the data in Sales Order through a custom script, as shown below

Custome Doctype “Customer Code”

Data Within Doctype Which points the Actual Client.

When I create the New Sales Order without any restricted user/Field Permission it works and even fetch the data for me.

it saves also and submit also, but when I want to save the same sales order from the user which is having field based restriction i.e. Customer name, address, pricing stuff is not view able for him, it gives the following error.

The sales order where above mentioned things are not view able .

The Error,

After that I tried to create the new Sales order from the same restricted user but it also gives me the error.

This error includes the customer name in error.

This relates to Item Name/Price

Now it seems the mandatory fields are required to display on form(Sales Order or Any form) for doing save/submit, if it is not viewable to the user then he cannot save the form which is not correct because even the custom workflows will not work here.

But I think technically the Field which is Now view-able to the user must be there in background and it should get automatically filled even if it is not shown to the users, then why I am getting this error.

Please help me in this.

Regards

My guess is without some (major?) redesign, the current data model will not logically support the ‘restricted field’ access behaviour that you require.

The ‘missing mandatory field’ messages you get (that relate to Customer and Sales Order) confirm the data model requires these fields to read/display or write/save their form data views.

Rather than introduce Client Code etc that uncovers the data model restrictions you are encountering, I suggest best to exploit the permission and hidden field options.

edit: there’s this access control https://erpnext.org/docs/user/manual/en/setting-up/users-and-permissions/user-permissions.html

As well I urge you to search around to learn what others have done for eg How to hide fields from users! - #4 by ajit.jain1

@clarkej

Thanks for the suggestion, I have done my R&D and mark all the field hidden instead of putting field permission, that is working for me, now I have stuck at where customer read permission is required, in Sales order Below are the field settings

As you can see that I have marked this field hidden.

And Same goes for Customer Name.

Below are the permission of the Roles who will access it.

Now the problem is when I give read access to the roles the Customer Page in the selling modules is appearing.

Which is not serving my purpose, because the both roles which are mentioned above can still read the customer details from the above page in selling module.

and if I remove the customer read permission then it will not let me create the sales order, because anyway customer is required to complete the sales order, and I could not find the way to serve the both conditions.

My purpose will server only if after giving the read permission to roles the customer page should not appear in the selling module, or removing the read permission from the customers for both roles and they are still able to read the customers from the above mentioned fields i.e Sales Order Customer Field and Sales order Customer Name field.

Any suggestion… how to accomplish this will be appreciated.

Regard,

all this field it use under under sales ordre you give them a new Perm Level example 3 under “customer”
hereafter change the Perm Level to 3 under this 2 group.

it should work