[IMP] Ir Action Server - Fix the domain for the field 'Link Using field'.
authorJeremy Kersten <jke@odoo.com>
Tue, 17 Jun 2014 13:17:14 +0000 (15:17 +0200)
committerJeremy Kersten <jke@odoo.com>
Tue, 17 Jun 2014 13:20:52 +0000 (15:20 +0200)
openerp/addons/base/ir/ir_actions.py
openerp/addons/base/ir/ir_actions.xml

index 748e209..21ad57f 100644 (file)
@@ -462,6 +462,8 @@ class ir_actions_server(osv.osv):
                                    "based on the sequence. Low number means high priority."),
         'model_id': fields.many2one('ir.model', 'Base Model', required=True, ondelete='cascade',
                                     help="Base model on which the server action runs."),
+        'model_name': fields.related('model_id', 'model', type='char',
+                                     string='Model Name', readonly=True),
         'menu_ir_values_id': fields.many2one('ir.values', 'More Menu entry', readonly=True,
                                              help='More menu entry.'),
         # Client Action
@@ -620,6 +622,10 @@ class ir_actions_server(osv.osv):
             'wkf_field_id': False,
             'crud_model_id': model_id,
         }
+
+        if model_id:
+            values['model_name'] = self.pool.get('ir.model').browse(cr, uid, model_id, context).model
+
         return {'value': values}
 
     def on_change_wkf_wonfig(self, cr, uid, ids, use_relational_model, wkf_field_id, wkf_model_id, model_id, context=None):
@@ -723,6 +729,7 @@ class ir_actions_server(osv.osv):
         crud_model_name = False
         if crud_model_id:
             crud_model_name = self.pool.get('ir.model').browse(cr, uid, crud_model_id, context).model
+        
         values = {'link_field_id': False, 'crud_model_name': crud_model_name}
         return {'value': values}
 
index 7ac0252..c999755 100644 (file)
                                             Check to attach the newly created record to the record on which the server action runs.
                                         </p>
                                         <group>
+                                            <field name="model_name" invisible="1"/>
                                             <field name="link_field_id"
-                                                    domain="[('model_id', '=', model_id), ('relation', '=', crud_model_name), ('ttype', 'in', ['many2one'])]"
+                                                    domain="[('model_id', '=', crud_model_id), ('relation', '=', model_name), ('ttype', 'in', ['many2one'])]"
                                                     attrs="{'required': [('state', '=', 'object_create'), ('link_new_record', '=', True)],
                                                             'invisible': ['|', ('state', '!=', 'object_create'), ('link_new_record', '=', False)]}"/>
                                         </group>