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.
Hi, I am trying to get the module to work but it's not sending any mail. I can send emails otherwise, like with the sale auto reply. Should there be a server action? I am obviously missing something. I would be grateful I you could steer me in the right direction.
ReplyDeleteRegards,
A
Some suggestions:
ReplyDelete1) Make sure you're using the "E-mail template" in the "Actions" tab instead of the "Email" tab. And check the "Send immediately" box.
2) Check for bad emails in Settings » Configuration » Email » Messages. Maybe the mail message fails because of missing required fields, such as "To".
You may also find useful this SO answer: http://stackoverflow.com/a/13305047/959570
I have the same settings as you in SO, can preview template with correct parameters and send email from issues communication. Any other ideas? I presume that by just filling this expression:
ReplyDeleteinserting or changed.get('state') == 'draft'
The system will then send an auto_reply email to 'To' email recipiant upon creation of an issue?
There should be a "Debug Evaluated expression" checkbox under the "Evaluated Expression" text area. Enable it and restart your server with the --debug option. You should see more details in the server log on what's going on.
ReplyDeleteThis module is obsolete now, is it? Because its not working under openERP 7.x.
ReplyDeletenice try this: https://learnopenerp.blogspot.com/2020/05/how-to-create-scheduled-action-in-odoo.html
ReplyDelete