diff options
| author | TWA <twa@odoo.com> | 2018-08-06 09:23:40 +0000 |
|---|---|---|
| committer | Yannick Tivisse <yti@odoo.com> | 2018-10-09 11:28:00 +0000 |
| commit | 983c7e81529eb26a7a756e7d875b5638a26a3733 (patch) | |
| tree | 102dcb58f7b2e42e30ee3218ecce8849cf1dbb65 /addons/mail/wizard/invite.py | |
| parent | a799b1329297c7a5fee84fe772e85d22cbf2c5fc (diff) | |
[IMP] mail,crm,...: Replace occurences of name_get()[0][1] by display_name
Purpose
=======
display_name is equal to doing name_get()[0][1]
Replacing name_get()[0][1] by display_name could be good for 2 things:
- Uniformization of the code
- Probable optimization if name_get is used inside a for loop on a recordset (as the values will be prefetched and put in the cache).
TaskID: 1849250
closes odoo/odoo#26341
Diffstat (limited to 'addons/mail/wizard/invite.py')
| -rw-r--r-- | addons/mail/wizard/invite.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/addons/mail/wizard/invite.py b/addons/mail/wizard/invite.py index 39d6c0bdeeb..35d04f66659 100644 --- a/addons/mail/wizard/invite.py +++ b/addons/mail/wizard/invite.py @@ -12,14 +12,14 @@ class Invite(models.TransientModel): @api.model def default_get(self, fields): result = super(Invite, self).default_get(fields) - user_name = self.env.user.name_get()[0][1] + user_name = self.env.user.display_name model = result.get('res_model') res_id = result.get('res_id') if self._context.get('mail_invite_follower_channel_only'): result['send_mail'] = False if 'message' in fields and model and res_id: model_name = self.env['ir.model']._get(model).display_name - document_name = self.env[model].browse(res_id).name_get()[0][1] + document_name = self.env[model].browse(res_id).display_name message = _('<div><p>Hello,</p><p>%s invited you to follow %s document: %s.</p></div>') % (user_name, model_name, document_name) result['message'] = message elif 'message' in fields: @@ -50,9 +50,9 @@ class Invite(models.TransientModel): # send an email if option checked and if a message exists (do not send void emails) if wizard.send_mail and wizard.message and not wizard.message == '<br>': # when deleting the message, cleditor keeps a <br> message = self.env['mail.message'].create({ - 'subject': _('Invitation to follow %s: %s') % (model_name, document.name_get()[0][1]), + 'subject': _('Invitation to follow %s: %s') % (model_name, document.display_name), 'body': wizard.message, - 'record_name': document.name_get()[0][1], + 'record_name': document.display_name, 'email_from': email_from, 'reply_to': email_from, 'model': wizard.res_model, |
