Each automated action rule operates on an OpenERP model, any model. It's behaviour is defined through three tabs:
- Conditions tell when the rule is fired.
- Actions tell what operations should be done, like setting a specific user as Responsible person, or running a Server Action.
- E-mail actions allows to define e-mail messages to be sent .
Conditions can be activated at scheduled moments. This is the sole purpose of the "Conditions on Time" section. The scheduler action evaluates these conditions to decide what rules to trigger. This allows you to configure actions like "send an e-mail reminder two days after last action date".
The remaining conditions are evaluated immediately when a record is saved. This allows you to configure actions like "send an e-mail when state is changed to In Progress".
While you get the feeling of having a lot of potential to easily customize a customer's very specific business rules, actually the module reveals to fall short on the expectations.
For instance, it's not possible to create conditions for:
- When a new Issue is created, sending an e-mail informing the new Issue;
- When the Responsible is changed, sending an e-mail informing the new responsible person.
The reis_base_action_rule_triggers module overcomes these limitations and unlocks a lot of the power of the standard module. This is done through two simple additions:
- Conditions can be defined by an "Evaluated expression", that can work on record's old and new values.
- Actions can send an e-mail using v6.1 Email templates, a lot more powerful than the "e-mail actions" options, making them obsolete.
- inserting, creating: boolean indicating it's a new record is being created;
- updating, writing: boolean indicating it's an existing record being changed;
- new: a dictionary with all the values after the record is changed;
- old: a dictionary with all the values before the record was changed;
- changed: a dictionary with only the values that actually changed, even if rewritten (empty if not updating);
- obj: browseable record object, allowing dot notation, with the new/changed record.
New issue is created, or is reactivated:
inserting or changed.get('state') == 'draft'
Issue is closed or cancelled:
changed.get('state') in ('done', 'cancel')
Issue's Responsible changed:
old.get('user_id') and new.get('user_id')
and old.get('user_id') != new.get('user_id')
and not new.get('date_open') #date_open is written only by Open issue
I hope this turn out useful to more people, and would love to hear about your experience with this module.