[IMP]Putting a domain of filter to see only filters of the choosen model.

bzr revid: dhr@tinyerp.com-20130304052058-fzs7a6ct9d1xb5so
This commit is contained in:
Dharti Ratani (Open ERP) 2013-03-04 10:50:58 +05:30
parent d9966b45d8
commit 62fc309e0c
2 changed files with 12 additions and 1 deletions

View File

@ -182,6 +182,17 @@ class config(osv.osv):
'name_template': fields.char('Google Drive Name Pattern', size=64, help='Choose how the new google drive will be named, on google side. Eg. gdoc_%(field_name)s', required=True),
}
def onchange_model_id(self, cr, uid, ids, model_id):
res = {'domain':{'filter_id':[]}}
if model_id:
model_name = self.pool.get('ir.model').read(cr, uid, model_id, ['model'])
if model_name:
mod_name = model_name['model']
res['domain'] = {'filter_id': [('model_id', '=', mod_name)]}
else:
res['value'] = {'filter_id': False}
return res
_defaults = {
'name_template': 'gdoc_%(name)s',
}

View File

@ -21,7 +21,7 @@
<field name="arch" type="xml">
<form string="Google Drive Configuration" version="7.0">
<group>
<field name="model_id"/>
<field name="model_id" on_change="onchange_model_id(model_id)"/>
<label for='filter_id'/>
<div>
<field name='filter_id'/>