diff --git a/addons/base_action_rule/base_action_rule.py b/addons/base_action_rule/base_action_rule.py
index 9440716815c..683a247c8d1 100644
--- a/addons/base_action_rule/base_action_rule.py
+++ b/addons/base_action_rule/base_action_rule.py
@@ -247,7 +247,11 @@ trigger date, like sending a reminder 15 minutes before a meeting."),
if context is None:
context = {}
ok = True
-
+ if action.filter_id and action.model_id.model == action.filter_id.model_id:
+ ctx = dict(context)
+ ctx.update(eval(action.filter_id.context))
+ obj_ids = self.pool.get(action.model_id.model).search(cr, uid, eval(action.filter_id.domain), context=ctx)
+ ok = ok and obj.id in obj_ids
if getattr(obj, 'user_id', False):
ok = ok and (not action.trg_user_id.id or action.trg_user_id.id==obj.user_id.id)
if getattr(obj, 'partner_id', False):
diff --git a/addons/crm/crm_action_rule_demo.xml b/addons/crm/crm_action_rule_demo.xml
index 4adefee407d..85cb8de1ac9 100644
--- a/addons/crm/crm_action_rule_demo.xml
+++ b/addons/crm/crm_action_rule_demo.xml
@@ -9,17 +9,17 @@
ir.actions.server
email
object.user_id.email
- Reminder on Lead: [[object.id ]] of [[object.partner_id.name]]
+ Reminder on Lead: [[object.id ]] [[object.partner_id and 'of ' +object.partner_id.name or '']]
Hello [[object.user_id.name]],
-can you check following lead, it's inactive since 5 days ?
+can you check following lead, it's not open since 5 days ?
Lead: [[object.id ]]
-Customer: [[object.partner_id.name]]
+Description:
[[object.description]]
Thanks,
-
+
@@ -30,11 +30,11 @@ Thanks,
email
object.email_from
Reminder on Lead: [[object.id ]]
- Hello [[object.partner_id.name]],
-your following lead inactive since 5 days.
+ Hello [[object.partner_id and object.partner_id.name or '']],
+your following lead is not open since 5 days.
Lead: [[object.id ]]
-Customer: [[object.partner_id.name]]
+Description:
[[object.description]]
@@ -42,12 +42,19 @@ Thanks,
+
+ Filter on leads which are draft.
+ crm.lead
+ [('state','=','draft')]
+
+
- Set Auto Reminder on leads which are inactive since 5 days.
+ Set Auto Reminder on leads which are not open since 5 days.
1
- write
+
+ create
5
day