[IMP] add record_id on mail.message to be able to access to the record
This commit is contained in:
@@ -3,3 +3,4 @@
|
|||||||
from . import mail
|
from . import mail
|
||||||
from . import tools
|
from . import tools
|
||||||
from . import mail_template
|
from . import mail_template
|
||||||
|
from . import mail_message
|
||||||
|
|||||||
18
mail_usability/mail_message.py
Normal file
18
mail_usability/mail_message.py
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# Copyright 2019 Akretion (http://www.akretion.com).
|
||||||
|
# @author Sébastien BEAU <sebastien.beau@akretion.com>
|
||||||
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||||
|
|
||||||
|
from openerp import api, fields, models
|
||||||
|
|
||||||
|
|
||||||
|
class MailMessage(models.Model):
|
||||||
|
_inherit = 'mail.message'
|
||||||
|
|
||||||
|
@property
|
||||||
|
def record_id(self):
|
||||||
|
# we do not use a reference field here as mail message
|
||||||
|
# are used everywhere and many model are not yet loaded
|
||||||
|
# so odoo raise exception
|
||||||
|
self.ensure_one()
|
||||||
|
return self.env[self.model].browse(self.res_id)
|
||||||
Reference in New Issue
Block a user