diff --git a/addons/base_action_rule/base_action_rule.py b/addons/base_action_rule/base_action_rule.py
index e329eec4aa6..df57bc86ce8 100644
--- a/addons/base_action_rule/base_action_rule.py
+++ b/addons/base_action_rule/base_action_rule.py
@@ -60,7 +60,8 @@ class base_action_rule(osv.osv):
return [('', '')]
_columns = {
- 'name': fields.many2one('ir.model', 'Object', required=True),
+ 'name': fields.char('Rule Name', size=64, required=True),
+ 'model_id': fields.many2one('ir.model', 'Object', required=True),
'create_date': fields.datetime('Create Date', readonly=1),
'active': fields.boolean('Active', help="If the active field is set to False,\
it will allow you to hide the rule without removing it."),
@@ -125,6 +126,7 @@ the rule to mark CC(mail to any other person defined in actions)."),
_order = 'sequence'
def onchange_model_id(self, cr, uid, ids, name):
+ #This is not a good solution as it will affect the domain only on onchange
res = {'domain':{'filter_id':[]}}
if name:
model_name = self.pool.get('ir.model').read(cr, uid, [name], ['model'])
@@ -138,7 +140,7 @@ the rule to mark CC(mail to any other person defined in actions)."),
def pre_action(self, cr, uid, ids, model, context=None):
# Searching for action rules
cr.execute("SELECT model.model, rule.id FROM base_action_rule rule \
- LEFT JOIN ir_model model on (model.id = rule.name) \
+ LEFT JOIN ir_model model on (model.id = rule.model_id) \
where active")
res = cr.fetchall()
# Check if any rule matching with current object
@@ -175,7 +177,7 @@ the rule to mark CC(mail to any other person defined in actions)."),
if not context:
context = {}
for action_rule in self.browse(cr, uid, ids, context=context):
- model = action_rule.name.model
+ model = action_rule.model_id.model
obj_pool = self.pool.get(model)
obj_pool.__setattr__('create', self._create(obj_pool.create, model, context=context))
obj_pool.__setattr__('write', self._write(obj_pool.write, model, context=context))
@@ -257,7 +259,7 @@ the rule to mark CC(mail to any other person defined in actions)."),
@param context: A standard dictionary for contextual values """
ok = True
if action.filter_id:
- if action.name.model == action.filter_id.model_id:
+ if action.model_id.model == action.filter_id.model_id:
context.update(eval(action.filter_id.context))
obj_ids = obj._table.search(cr, uid, eval(action.filter_id.domain), context=context)
if not obj.id in obj_ids:
@@ -280,8 +282,6 @@ the rule to mark CC(mail to any other person defined in actions)."),
ok = ok and (not action.trg_state_from or action.trg_state_from==obj.state)
if state_to:
ok = ok and (not action.trg_state_to or action.trg_state_to==state_to)
- elif action.trg_state_to:
- ok = False
reg_name = action.regex_name
result_name = True
if reg_name:
@@ -355,7 +355,7 @@ the rule to mark CC(mail to any other person defined in actions)."),
if not scrit:
scrit = []
for action in self.browse(cr, uid, ids):
- model_obj = self.pool.get(action.name.model)
+ model_obj = self.pool.get(action.model_id.model)
for obj in objects:
ok = self.do_check(cr, uid, action, obj, context=context)
if not ok:
diff --git a/addons/base_action_rule/base_action_rule_data.xml b/addons/base_action_rule/base_action_rule_data.xml
index 288215202d6..7a9aabedf5f 100644
--- a/addons/base_action_rule/base_action_rule_data.xml
+++ b/addons/base_action_rule/base_action_rule_data.xml
@@ -1,7 +1,8 @@
-
+
+
Check Action Rules
4
hours
@@ -10,10 +11,7 @@
-
-
-
-
-
+
+
diff --git a/addons/base_action_rule/base_action_rule_view.xml b/addons/base_action_rule/base_action_rule_view.xml
index 1a9c1946b3c..66f857c4e94 100644
--- a/addons/base_action_rule/base_action_rule_view.xml
+++ b/addons/base_action_rule/base_action_rule_view.xml
@@ -14,10 +14,11 @@
form