Multi is the default api for methods, it is not necessary to explicitly decorate methods with it, adds clutter and most people use it because they see that the rest of the code uses it. Done with `find . -type f -name '*.py' | xargs sed -i '/@api.multi/d'`
34 lines
946 B
Python
34 lines
946 B
Python
# -*- coding: utf-8 -*-
|
|
from odoo import models, api
|
|
from lxml.builder import E
|
|
|
|
|
|
class BaseModel(models.AbstractModel):
|
|
_inherit = 'base'
|
|
|
|
@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)
|
|
|
|
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),
|
|
}
|