[REF] mail: rename mail.notification mail_id to mail_mail_id
PURPOSE Be aligned with mail_mail model naming as well as convention used in SMS application (sms_sms_id, sms_sms_int) and mass mailing application (using mail_mail_id on mailing.trace model). LINKS Task ID-2377974 Community PR odoo/odoo#61467 Enterprise PR odoo/enterprise#14633 Upgrade PR odoo/upgrade#1907 Co-Authored-By: Rémy Voet <ryv@odoo.com> Co-Authored-By: Thibault Delavallée <tde@odoo.com>
This commit is contained in:
co-authored by
Rémy Voet
parent
bbf4783ac6
commit
7e98beef84
@@ -160,7 +160,7 @@ class MailMail(models.Model):
|
||||
if notif_mails_ids:
|
||||
notifications = self.env['mail.notification'].search([
|
||||
('notification_type', '=', 'email'),
|
||||
('mail_id', 'in', notif_mails_ids),
|
||||
('mail_mail_id', 'in', notif_mails_ids),
|
||||
('notification_status', 'not in', ('sent', 'canceled'))
|
||||
])
|
||||
if notifications:
|
||||
@@ -360,7 +360,7 @@ class MailMail(models.Model):
|
||||
# mail record.
|
||||
notifs = self.env['mail.notification'].search([
|
||||
('notification_type', '=', 'email'),
|
||||
('mail_id', 'in', mail.ids),
|
||||
('mail_mail_id', 'in', mail.ids),
|
||||
('notification_status', 'not in', ('sent', 'canceled'))
|
||||
])
|
||||
if notifs:
|
||||
|
||||
@@ -17,7 +17,7 @@ class MailNotification(models.Model):
|
||||
|
||||
# origin
|
||||
mail_message_id = fields.Many2one('mail.message', 'Message', index=True, ondelete='cascade', required=True)
|
||||
mail_id = fields.Many2one('mail.mail', 'Mail', index=True, help='Optional mail_mail ID. Used mainly to optimize searches.')
|
||||
mail_mail_id = fields.Many2one('mail.mail', 'Mail', index=True, help='Optional mail_mail ID. Used mainly to optimize searches.')
|
||||
# recipient
|
||||
res_partner_id = fields.Many2one('res.partner', 'Recipient', index=True, ondelete='cascade')
|
||||
# status
|
||||
|
||||
@@ -2254,13 +2254,13 @@ class MailThread(models.AbstractModel):
|
||||
tocreate_recipient_ids = [rid for rid in recipient_ids if rid not in existing_notifications.mapped('res_partner_id.id')]
|
||||
existing_notifications.write({
|
||||
'notification_status': 'ready',
|
||||
'mail_id': email.id,
|
||||
'mail_mail_id': email.id,
|
||||
})
|
||||
notif_create_values += [{
|
||||
'mail_message_id': message.id,
|
||||
'res_partner_id': recipient_id,
|
||||
'notification_type': 'email',
|
||||
'mail_id': email.id,
|
||||
'mail_mail_id': email.id,
|
||||
'is_read': True, # discard Inbox notification
|
||||
'notification_status': 'ready',
|
||||
} for recipient_id in tocreate_recipient_ids]
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
<group string="Source">
|
||||
<field name="mail_message_id"/>
|
||||
<field name="notification_type"/>
|
||||
<field name="mail_id"/>
|
||||
<field name="mail_mail_id"/>
|
||||
<field name="res_partner_id"/>
|
||||
</group>
|
||||
<group string="Status">
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
<xpath expr="//field[@name='res_partner_id']" position="after">
|
||||
<field name="sms_number"/>
|
||||
</xpath>
|
||||
<xpath expr="//field[@name='mail_id']" position="after">
|
||||
<xpath expr="//field[@name='mail_mail_id']" position="after">
|
||||
<field name="sms_id"/>
|
||||
</xpath>
|
||||
</field>
|
||||
|
||||
@@ -406,8 +406,8 @@ class AdvancedResponsibleNotifiedTest(TestMailCommon):
|
||||
# verify that a mail.mail is attached to it with the correct state ('outgoing')
|
||||
mail_notification = mail_message.notification_ids
|
||||
self.assertEqual(1, len(mail_notification))
|
||||
self.assertTrue(bool(mail_notification.mail_id))
|
||||
self.assertEqual('outgoing', mail_notification.mail_id.state)
|
||||
self.assertTrue(bool(mail_notification.mail_mail_id))
|
||||
self.assertEqual(mail_notification.mail_mail_id.state, 'outgoing')
|
||||
|
||||
|
||||
@tagged('post_install', '-at_install')
|
||||
|
||||
@@ -153,7 +153,7 @@ class TestMailMailRace(common.TransactionCase):
|
||||
'subtype_id': self.ref('mail.mt_comment'),
|
||||
'notification_ids': [(0, 0, {
|
||||
'res_partner_id': self.partner.id,
|
||||
'mail_id': mail.id,
|
||||
'mail_mail_id': mail.id,
|
||||
'notification_type': 'email',
|
||||
'is_read': True,
|
||||
'notification_status': 'ready',
|
||||
|
||||
Reference in New Issue
Block a user