[FIX] mail: display translated model name at record creation

When a record is created, if it inherits from mail.thread, a message 'OBJECT created' is posted. 'created' is translated but the name of the model wasn't.
This fix uses the name of the linked ir.model which is already a translatable field.
lp:1262000, opw 611043
This commit is contained in:
Sandy Carter 2014-07-15 16:17:36 -04:00 committed by Martin Trigaux
parent f9d43e83c6
commit 67cca3f1e5
1 changed files with 4 additions and 1 deletions

View File

@ -253,7 +253,10 @@ class mail_thread(osv.AbstractModel):
# automatic logging unless asked not to (mainly for various testing purpose)
if not context.get('mail_create_nolog'):
self.message_post(cr, uid, thread_id, body=_('%s created') % (self._description), context=context)
ir_model_pool = self.pool['ir.model']
ids = ir_model_pool.search(cr, uid, [('model', '=', self._name)], context=context)
name = ir_model_pool.read(cr, uid, ids, ['name'], context=context)[0]['name']
self.message_post(cr, uid, thread_id, body=_('%s created') % name, context=context)
# auto_subscribe: take values and defaults into account
create_values = dict(values)