[MERGE] base_action_rule: adding onchange on model_id in order to get the related field updated. Fix issue 586436. Merge of jco branch with small refactoring and context added

bzr revid: qdp-launchpad@openerp.com-20130225174112-aoe9ts8linp5fx1l
This commit is contained in:
Quentin (OpenERP) 2013-02-25 18:41:12 +01:00
commit 3be6693f3e
2 changed files with 8 additions and 1 deletions

View File

@ -214,6 +214,13 @@ class base_action_rule(osv.osv):
self._register_hook(cr, ids)
return True
def onchange_model_id(self, cr, uid, ids, model_id, context=None):
data = {'model': False, 'filter_pre_id': False, 'filter_id': False}
if model_id:
model = self.pool.get('ir.model').browse(cr, uid, model_id, context=context)
data.update({'model': model.model})
return {'value': data}
def _check(self, cr, uid, automatic=False, use_new_cursor=False, context=None):
""" This Function is called by scheduler. """
context = context or {}

View File

@ -15,7 +15,7 @@
<h1><field name="name"/></h1>
<group>
<group>
<field name="model_id"/>
<field name="model_id" on_change="onchange_model_id(model_id, context)"/>
<field name="model" invisible="1"/>
</group>
<group>