Role based approval of a document based on document value


Problem Statement :

When an organization grows or it is already of a size which requires significant subordination and delegation to mid or lower level management, it becomes important to let them take certain financial decisions. Typically, if the financial impact is very less, the lower level management can take decision, if it is average then the mid level management can take call, otherwise it must be routed to the higher management

One sample example of such process would be

  • if the purchase order is of amount less than 100 USD (configurable), then it can be approved by Store manager
  • if it is in between 100 to 500 USD, then it must go for purchase manager approval
  • if it is beyond 500 USD, then it must go for CFO approval

From ERP we expect, Amounts and roles should be configurable and amount field should also be configurable. The existing ADempiere functionality does provide support for some of the functionality.

However, it is not designed to fulfill all the needs mentioned above. It has following limitations

  • It does not allow to configure amount field.
  • If user ( based on role he/she has) does not have permissions to approve certain amount, it checks corresponding users supervisor rather than checking another role for approval

Scope Of Article :

As part of this article we will cover following topics

  • Brief overview of the changes in ADempiere to get the desired behavior
  • how to configure workflow
  • Demonstration on behavior of workflow

Technology :

  • ADempiere 360 LTS or higher version

Details :

Step1 : Brief overview of the changes in ADempiere to get the desired behavior

  •  Create a new “Responsible Type” reference

ResponsibleType

  •  Create a workflow responsible and give the  Responsible Type created in step 1 here.

Responsible

  • Add new widget in Node tab of the workflow window, to allow user to select the entity which drives the workflow
  • This new widget will show the list of fields in the table configured at the workflow level which are of type numeric.
  • Make code changes in MWFActivity.java to redirect request to users based amount and role configuration
  • Make code changes in WWFActivity.java to show all the nodes that waiting for approval, based on role, corresponding user logged in

STEP 2 : Configuring workflow

  • Open the ‘Purchase Order’ workflow
  • Go to the Node Tab and select the node which is having the Action as User Choice (that means from this node, the workflow process will go for the user approval).

NodeTabUserChoice

  •  Once you select Workflow responsible as “Value Based Roles”  the Amount Column will appear , which  will show all the columns which are of type numeric.

NodetabWFResponsible

  • Here select the column, which is  considered as the parameter to drive the work flow approval process to  the users in the respective role. In this case it is ‘Grand Total’ of the purchase order  NodeTabAmountColumn
  •  Now create roles or modify existing roles to have maximum amount that they can approve

RoleDefinition

  •  For each role assign users (to simplify the process we have created users with same name as the role name)

UserAssignmentSM

UserAssignmentPM

UserAssignmentCFO

  •  Create ‘Admin’ user and assign role, this role will have zero approval amount. This user will be used to create purchase order

STEP 3 :   Demonstration on behavior of workflow

CASE 1 :  Workflow where an order  can be approved by “Store Manager”

  • Login as an ‘Admin’ user and Create a purchase Order

CreatePO

  • Create purchase order line and value of purchase is 80

CreatePOLine

  • Now Complete the Purchase orderCompletePO
  • Log in with CFO User. Request is waiting for his/her approval

CFOApproval

  • Log in with Purchase Manager. Request is waiting for his/her approval

PMApproval

  • Log in with Store Manager. Request is waiting for his/her approvalSMApproval

CASE 2 : Workflow approval should go to purchase manager, CFO

  • Login as ‘Admin’ user and Create a purchase OrderCreatePO2
  • Create purchase order line and value of purchase is 102, this means ‘store manager’ can not approve this

CreatePOLine2

  • Now Complete the Purchase order

CompletePO2

  • Log in with CFO User. Request is waiting for his/her approvalCFOApproval2
  • Log in with Purchase Manager. Request is waiting for his/her approval

PMApproval2

  • Log in with Store Manager. Request is not waiting for his/her approval

SMApproval2

So request went to all the users of roles, where role approval amount is greater than ‘Grand Total’ of purchase order

CASE 3 : Workflow approval should go to CFO

  • Login as ‘Admin’ user and Create a purchase OrderCreatePO3
  • Create purchase order line and value of purchase is 6000, this means ‘store manager’ ,’Purchase Manager’ can not approve thisCreatePOLine3
  • Complete the purchase Order

CompletePO3

  • Log in with CFO User. Request is waiting for his/her approval

CFOApproval3

  • Log in with Purchase Manager. Request is waiting for his/her approvalPMApproval3
  • Log in with Store Manager. Request is not waiting for his/her approvalSMApproval3

Summary:

With small changes in the existing ADempiere workflow, we are able to decentralize decision making process. These changes will improve efficiency across different levels in organization. End user will just just need to configure roles and corresponding approval amounts. Rest of the things are taken care by ADempiere.

Walking Tree promotes ADempiere and we support the users as well as the developers to ensure that the business is able to take complete advantage of ADempiere’s wonderful capability. In case you are looking for a professional assistance then do visit our website to get in touch with us.

References:

Tagged with: , , , , , , ,
Posted in ADempiere, EagleRP
One comment on “Role based approval of a document based on document value
  1. osmar benavidez says:

    Hi ravurisuman, how are you?, in first case i apologize for my english writing, my natal Languaje is Spanish.

    I’ve followed the post, and I missed the part of redirect request to users based amount and role configuration in MWFActivity.java. I don’t know in what part of de class code i have to.

    I ask you please to help me how to get that. thanks in advance for everything.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

We Have Moved Our Blog!

We have moved our blog to our company site. Check out https://walkingtree.tech/index.php/blog for all latest blogs.

Sencha Select Partner Sencha Training Partner
Xamarin Authorized Partner
Recent Publication
%d bloggers like this: