summaryrefslogtreecommitdiff
path: root/addons/mail/models/models.py
diff options
context:
space:
mode:
authorHiral Bhavsar <hbh@odoo.com>2019-02-04 06:18:08 +0000
committerMartin Geubelle <mge@odoo.com>2019-05-03 10:19:40 +0000
commitb2de618f9ff9969ff0644f3be10752f23d9738dc (patch)
treea7f54bb16273f3b626a96d363e0f54bf19bb4ba3 /addons/mail/models/models.py
parentb29d4da037fbf73717cccdfcdf76d96e5b1b009b (diff)
[IMP] base,mail: allow to customize the activity view
The activity view has been greatly improved to allow to customize it more easily. It works quite similarly to the kanban view, defining `<field>` tags at the top and using these fields in the `<template>` section. The template name used to define the activity cards is `activity-box`. Note that these activity cards are rendered using `KanbanRecord` widget (this has implied that ActivityView inherits from `BasicView`). Also note that the view validation has been moved in base to include the common grammar. Task 1894990
Diffstat (limited to 'addons/mail/models/models.py')
-rw-r--r--addons/mail/models/models.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/addons/mail/models/models.py b/addons/mail/models/models.py
new file mode 100644
index 00000000000..4c85b08d2af
--- /dev/null
+++ b/addons/mail/models/models.py
@@ -0,0 +1,19 @@
+# -*- 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)