diff options
| author | Rajesh Prajapati (OpenERP) <rpr@tinyerp.com> | 2013-03-20 13:59:56 +0530 |
|---|---|---|
| committer | Rajesh Prajapati (OpenERP) <rpr@tinyerp.com> | 2013-03-20 13:59:56 +0530 |
| commit | c575ebfc4d181bbc9c2bc0cfa87f5fc6b36bd8ab (patch) | |
| tree | 6e641ba2efa02922baee6412027d45788df35f7a /addons/google_docs/google_docs.py | |
| parent | 1c251ffcf12007434f7c378916654ea14a04723e (diff) | |
[IMP] google_docs : constraint added
bzr revid: rpr@tinyerp.com-20130320082956-yuwftz4vp6xq11au
Diffstat (limited to 'addons/google_docs/google_docs.py')
| -rw-r--r-- | addons/google_docs/google_docs.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/addons/google_docs/google_docs.py b/addons/google_docs/google_docs.py index 2eabcb1f693..d487d31c0d6 100644 --- a/addons/google_docs/google_docs.py +++ b/addons/google_docs/google_docs.py @@ -243,17 +243,19 @@ 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,filter_id): - print 'fffffffff',filter_id + def onchange_model_id(self, cr, uid, ids, model_id, filter_id, context=None): res = {'domain':{'filter_id':[]}} if model_id: model_name = self.pool.get('ir.model').read(cr, uid, model_id, ['model']) + if filter_id: + filter = self.pool.get('ir.filters').read(cr, uid, filter_id, ['model_id']) + if not model_name['model'] == filter['model_id']: + raise osv.except_osv(_('Warning!'), _('Filter does not match with selected Model!')) if model_name: mod_name = model_name['model'] res['domain'] = {'filter_id': [('model_id', '=', mod_name)]} else: res['value'] = {'filter_id': False} - print 'rrrrrrr',res return res _defaults = { |
