[FIX] res_lang: prevent modification of language code

This commit is contained in:
Raphael Collet
2015-10-26 16:56:34 +01:00
parent cea0a80252
commit 81566103c0
+4
View File
@@ -194,6 +194,10 @@ class lang(osv.osv):
return grouping, thousands_sep, decimal_point
def write(self, cr, uid, ids, vals, context=None):
if 'code' in vals:
for lang in self.browse(cr, uid, ids, context):
if lang.code != vals['code']:
raise UserError(_("Language code cannot be modified."))
self._lang_get.clear_cache(self)
self._lang_data_get.clear_cache(self)
return super(lang, self).write(cr, uid, ids, vals, context)