Add show message id if display_name null

pull/1163/head
sonhd91 2023-01-09 15:22:34 +07:00 committed by Anna Janiszewska
parent b0e6937232
commit d23137df65
2 changed files with 20 additions and 0 deletions

View File

@ -2,3 +2,4 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from . import mail_tracking_value
from . import mail_message

View File

@ -0,0 +1,19 @@
from odoo import api, models
class MailMessage(models.Model):
_inherit = "mail.message"
@api.model
def name_get(self):
res = super(MailMessage, self).name_get()
params = self.env.context.get("params")
if params:
model = params.get("model")
view_type = params.get("view_type")
if model == "mail.tracking.value" and view_type == "form":
for rec in res:
if rec[1] == "False":
new_name = (rec[0], "Message ID - " + str(rec[0]))
res[res.index(rec)] = new_name
return res