Printable version XML version
Login
Name

Password


Join
Forgot your password?
erp5.org => wiki.erp5.org !

erp5.org has permanently moved to wiki.erp5.org !

Current status of ERP5 community websites:

  • www.erp5.org should redirect to wiki.erp5.org automaticcaly.
  • wiki.erp5.org is the place where fresh news and documentation are published.
  • cps.erp5.org is the old erp5 community website.

Note: if you created content in this ancient portal, please migrate it to the wiki. The old website will stay online as long as all contents are not mograted to the wiki.

Workflows with ERP5

Howto create a Worflow for ERP5 :

It should not be possible for a newbie in your company to destroy all your really important database. You also don't want one of them to be able to add some corrupted data. For example, if you keep a list a many organisations with wich your are working, it could be a disaster if anyone can modify their telephone number, their address, etc...

That's why there's a Workflow. So for example, a lot of people can be able to create/modify a new organisation, then submit is changes. Then, a reviewer can confirm or not the change. In the first state (where someone enter the date), the organisation is in a private state, almost no one can see it. After this person can submit is change, then the reviewer can accept it, so the document will be in a new state : registered. In the registered state, the organisation will join the others.

There's a portal in order to manage workflows : portal_worklow. Let's see how to create a new workflow for organisations.

Create the workflow :

Inside the portal_worklow of your ERP5 Site, you have to select the "content" tab, then add a workflow.

Transitions :

We will create a very simple workflow. First the new organisation will be in a private state. Then it can be submitted so it will be in the state proposed. So the submission is a transition between two states. In order to create it, you shall select the tab "transitions", and add a transition called submit :

The guard section defines who has the permission to do this transition. If any of the 3 values Permission, Role or Expression give 1, then the transition is accepted.

The Display in actions box section defines how the action is named and wich screen we will display. Here, it's "%(content_url)s/organisation_submit". That means we shall create a new skin in order to manage the transition. So in the portal_skin, you shall add a skin named "organisation_submit" in the custom folder.

The transition skin :

Inside the content tab, you shall create a "TextAreaField" in order to register a comment, and a "StringField", called "my_workflow_action" with the Default value set to "submit".

We shall also create two other transitions : "register" and "unregister".

State :

Once you created all transitions, you can create all the states. For our example, we need : private, proposed, registered, unregistered. For each state, we should select wich transition can follow. So from a private state, we can go to the submit transition.

DON'T FORGET TO SET THE INITIAL STATE OF ANY OBJECT !!!! Or you will have this error : None object does not have getId !!

Permission :

We can associate different permissions with each state. First, in the "permission" tab of your portal_type, you can add wich permissions you want to manage with your workflow. For example, we can manage the view permission.

After, you can select one of your state, then select the permission tab, and you will see that you can set who have the right to view the object in this current state. This is usefull, because for example only the owner can see his document when it is in a private state, then in a proposed state, you can specify that the owner and a reviewer can see the document.


(c) 2001-2004 ERP5 Foundation
www.erp5.org
All Content Published Under Free Licenses
Powered by ERP5 Open Source ERP, Zope, CPS and Nexedi