diff options
| author | Rucha (Open ERP) <rpa@tinyerp.com> | 2013-03-28 12:42:12 +0530 |
|---|---|---|
| committer | Rucha (Open ERP) <rpa@tinyerp.com> | 2013-03-28 12:42:12 +0530 |
| commit | f3d3de20de66a798d928ee31afd462266a79ef46 (patch) | |
| tree | f27589f7b17fcb49d136daa4522feb8ee2aa4d78 /addons/google_docs/google_docs.py | |
| parent | 074661f4c7162193701cf0321d0532d880b6db9e (diff) | |
[REF]: google_docs: Improved code for constraint
bzr revid: rpa@tinyerp.com-20130328071212-kaim6d0oblhhq1a5
Diffstat (limited to 'addons/google_docs/google_docs.py')
| -rw-r--r-- | addons/google_docs/google_docs.py | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/addons/google_docs/google_docs.py b/addons/google_docs/google_docs.py index dd2d9062080..c33fbbde616 100644 --- a/addons/google_docs/google_docs.py +++ b/addons/google_docs/google_docs.py @@ -277,19 +277,13 @@ class config(osv.osv): } def _check_model_id(self, cr, uid, ids, context=None): - pool_id = self.browse(cr, uid, ids[0], context=context) - model_id = pool_id.model_id.id - filter_id = pool_id.filter_id.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 model_name['model'] != filter['model_id']: - return False + config_id = self.browse(cr, uid, ids[0], context=context) + if config_id.filter_id.id and config_id.model_id.model != config_id.filter_id.model_id: + return False return True _constraints = [ - (_check_model_id, 'The model or filter chosen have not matched.', ['model_id','filter_id']), + (_check_model_id, 'Model of selected filter is not matching with model of current template.', ['model_id','filter_id']), ] config() |
