PURPOSE
Since v13 some commits added code in mail thread file. This file is already
quite long and keeping it organized allow to understand its content.
SPECIFICATIONS
Clearly separate CRUD / CRUD HELPERS / TRACKING / ... . Notably tracking
code was split accross two code sections.
Make some internal tools methods private. They do not require to be public
* with_lang: does not makes sense to be available outside of odoo. It is
renamed to _fallback_lang as it does not allow to set a specific lang in
the environment like with_user. It is used to fallback on user's lang
in context;
* get_mail_message_access: purely internal method used for access rights;
LINKS
Task ID-2327096 (code cleaning)
PR #56631
X-original-commit: 4a5fc70cfc3c86da33e2480fbd59c8f6d575c6e9
45 lines
1.3 KiB
Python
45 lines
1.3 KiB
Python
# -*- coding: utf-8 -*-
|
|
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
|
|
|
from lxml.builder import E
|
|
|
|
from odoo import models, api
|
|
|
|
|
|
class BaseModel(models.AbstractModel):
|
|
_inherit = 'base'
|
|
|
|
# ------------------------------------------------------------
|
|
# ACTIVITY
|
|
# -----------------------------------------------------------
|
|
|
|
@api.model
|
|
def _get_default_activity_view(self):
|
|
""" Generates an empty activity view.
|
|
|
|
:returns: a activity view as an lxml document
|
|
:rtype: etree._Element
|
|
"""
|
|
field = E.field(name=self._rec_name_fallback())
|
|
activity_box = E.div(field, {'t-name': "activity-box"})
|
|
templates = E.templates(activity_box)
|
|
return E.activity(templates, string=self._description)
|
|
|
|
# ------------------------------------------------------------
|
|
# GATEWAY: NOTIFICATION
|
|
# ------------------------------------------------------------
|
|
|
|
def _notify_email_headers(self):
|
|
"""
|
|
Generate the email headers based on record
|
|
"""
|
|
if not self:
|
|
return {}
|
|
self.ensure_one()
|
|
return repr(self._notify_email_header_dict())
|
|
|
|
def _notify_email_header_dict(self):
|
|
return {
|
|
'X-Odoo-Objects': "%s-%s" % (self._name, self.id),
|
|
}
|