[IMP] base: improve some error messages/translations (modified patch from P. Christeas)
authorOlivier Dony <odo@openerp.com>
Wed, 20 Oct 2010 17:17:39 +0000 (19:17 +0200)
committerOlivier Dony <odo@openerp.com>
Wed, 20 Oct 2010 17:17:39 +0000 (19:17 +0200)
bzr revid: odo@openerp.com-20101020171739-2uc9a6fechrl5iaj

bin/addons/base/ir/ir_model.py
bin/addons/base/module/module.py
bin/addons/base/res/res_config.py

index e6b4a2d..3f3700b 100644 (file)
@@ -209,7 +209,7 @@ class ir_model_fields(osv.osv):
                 raise except_orm(_('Error'), _("Custom fields must have a name that starts with 'x_' !"))
 
             if vals.get('relation',False) and not self.pool.get('ir.model').search(cr, user, [('model','=',vals['relation'])]):
-                 raise except_orm(_('Error'), _("Model %s Does not Exist !" % vals['relation']))
+                 raise except_orm(_('Error'), _("Model %s does not exist!") % vals['relation'])
 
             if self.pool.get(vals['model']):
                 self.pool.get(vals['model']).__init__(self.pool, cr)
index b2c2da9..f552a24 100644 (file)
@@ -232,7 +232,7 @@ class module(osv.osv):
                 raise Exception('Unable to find %r in path' % (binary,))
 
 
-    def state_update(self, cr, uid, ids, newstate, states_to_update, context={}, level=100):
+    def state_update(self, cr, uid, ids, newstate, states_to_update, context=None, level=100):
         if level<1:
             raise orm.except_orm(_('Error'), _('Recursion error in modules dependencies !'))
         demo = False
@@ -240,7 +240,7 @@ class module(osv.osv):
             mdemo = False
             for dep in module.dependencies_id:
                 if dep.state == 'unknown':
-                    raise orm.except_orm(_('Error'), _("You try to install the module '%s' that depends on the module:'%s'.\nBut this module is not available in your system.") % (module.name, dep.name,))
+                    raise orm.except_orm(_('Error'), _("You try to install module '%s' that depends on module '%s'.\nBut the latter module is not available in your system.") % (module.name, dep.name,))
                 ids2 = self.search(cr, uid, [('name','=',dep.name)])
                 if dep.state != newstate:
                     mdemo = self.state_update(cr, uid, ids2, newstate, states_to_update, context, level-1,) or mdemo
@@ -252,7 +252,13 @@ class module(osv.osv):
             try:
                 self._check_external_dependencies(terp)
             except Exception, e:
-                raise orm.except_orm(_('Error'), _('Unable %s the module "%s" because an external dependencie is not met: %s' % (newstate, module.name, e.args[0])))
+                if newstate == 'to install':
+                    msg = _('Unable to install module "%s" because an external dependency is not met: %s')
+                elif newstate == 'to upgrade':
+                    msg = _('Unable to upgrade module "%s" because an external dependency is not met: %s')
+                else:
+                    msg = _('Unable to process module "%s" because an external dependency is not met: %s')
+                raise orm.except_orm(_('Error'), msg % (module.name, e.args[0]))
             if not module.dependencies_id:
                 mdemo = module.demo
             if module.state in states_to_update:
index 47667a5..1b4df76 100644 (file)
@@ -99,8 +99,7 @@ class res_config_configurable(osv.osv_memory):
         if not previous_todo:
             raise LookupError(_("Couldn't find previous ir.actions.todo"))
         if not state:
-            raise ValueError(_("Can't set an ir.actions.todo's state to "
-                               "nothingness"))
+            raise ValueError(_("Can't set an ir.actions.todo's state to an empty value."))
         previous_todo.write({'state':state})
 
     def _next(self, cr, uid, context=None):