diff options
| author | Stephane Wirtel <stephane@tinyerp.com> | 2008-12-23 00:58:21 +0100 |
|---|---|---|
| committer | Stephane Wirtel <stephane@tinyerp.com> | 2008-12-23 00:58:21 +0100 |
| commit | bbf26a2dfc9b67d12f564c61e16d354fa0ac694a (patch) | |
| tree | b4e66dfd0491faf2c8887fbaa930cd2b22d1855f /bin/addons/base/module/module.py | |
| parent | d163c3fd769eac9cdae4e5d533732dcfc3553cf5 (diff) | |
[IMP] Show a warning when the description field is empty
lp bug: https://launchpad.net/bugs/310660 fixed
bzr revid: stephane@tinyerp.com-20081222235821-nlsahuvczprzym0v
Diffstat (limited to 'bin/addons/base/module/module.py')
| -rw-r--r-- | bin/addons/base/module/module.py | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/bin/addons/base/module/module.py b/bin/addons/base/module/module.py index 3b8eff49b9b..f2541a17791 100644 --- a/bin/addons/base/module/module.py +++ b/bin/addons/base/module/module.py @@ -464,6 +464,29 @@ class module(osv.osv): logger.notifyChannel("init", netsvc.LOG_INFO, 'module %s: loading translation file for language %s' % (mod.name, lang)) tools.trans_load(cr.dbname, f, lang, verbose=False) + def write(self, cr, uid, ids, vals, context=None): + # Override the write method because we want to show a warning when the description field is empty ! + if isinstance( ids, (long, int) ): + ids = [ids] + if 'description' in vals and not vals['description']: + logger = netsvc.Logger() + for mod in self.browse(cr, uid, ids): + logger.notifyChannel("init", netsvc.LOG_WARNING, 'module %s: description is empty !' % (mod.name)) + + return super(module, self).write(cr, uid, ids, vals, context=context) + + def create(self, cr, uid, vals, context=None): + # Override the create method because we want to show a warning when the description field is empty ! + module_id = super(module, self).create(cr, uid, vals, context=context) + + if 'description' in vals and not vals['description']: + logger = netsvc.Logger() + for mod in self.browse(cr, uid, [module_id]): + logger.notifyChannel("init", netsvc.LOG_WARNING, 'module %s: description is empty !' % (mod.name)) + + return module_id + + module() class module_dependency(osv.osv): |
