We created a new doctype called Stock Transfer, which have a workflow of sent - in transit - recieved
Users default branch becomes the source branch and user then selects the target branch. Both branch fields have warehouse connected to it.
Now coming to user role permission and restriction.
We want the user to only have access to the document in which either the source or target branch is his default, but if i lock it with branch or warehouse then the user is not able to select the target warehouse where he wants to send the goods.
Mean user should only be able to see stock transfer docs which is either incoming or outgoing goods for him but at the same time
If in do ignore permission to target branch/ warehouse then user can only see those which have source branch/warehouse as their branch n able to select the target branch other than their own.
What in case another branch sends something to users branch that time use branch becomes target branch and senders branch becomes source branch.
In this case the user will not be able to see the document.
Does anyone have any idea how we can achieve this?