-
- % set user = ctx.get('user', user)
- % set company = user.company_id
- % set data = object.compute_kpis(company, user)
- % set tips = object.compute_tips(company, user)
- % set kpi_actions = object.compute_kpis_actions(company, user)
- % set kpis = data.yesterday.keys()
-
-
- |
- ${object.name}
- ${datetime.date.today().strftime('%B %d, %Y')}
- |
-
-
-
- |
-
-
-
- |
-
- % for kpi in kpis:
-
+
+ % set user = ctx.get('user', user)
+ % set company = user.company_id
+ % set data = object.compute_kpis(company, user)
+ % set tips = object.compute_tips(company, user, tips_count=ctx.get('tips_count', 1))
+ % set kpi_actions = object.compute_kpis_actions(company, user)
+ % set kpis = data.yesterday.keys()
+
+ | |
+
+
+
-
- ${object.fields_get()[kpi]['string']}
- %if kpi in kpi_actions:
-
- View more
-
- %endif
+ |
+
+
+
+ ${company.name}
+
+ ${object.name}
+ ${datetime.date.today().strftime('%B %d, %Y')}
+ |
+
+ Connect
+ |
+
+
|
+
+ |
+
+
+ % if tips:
+
+
+
+
-
-
+
+
-
-
-
-
- ${data['yesterday'][kpi][kpi]}
- Yesterday
- % if data['yesterday'][kpi]['margin'] != 0.0:
-
- % if data['yesterday'][kpi]['margin'] is greaterthan(0.0):
- ▲${"%.2f" % data['yesterday'][kpi]['margin']} %
- % endif
- % if data['yesterday'][kpi]['margin'] is lessthan(0.0):
- ▼${"%.2f" % data['yesterday'][kpi]['margin']} %
- % endif
-
- % endif
- |
-
-
+ |
+ ${tip | safe}
|
-
-
-
-
- ${data['lastweek'][kpi][kpi]}
- Last 7 Days
- % if data['lastweek'][kpi]['margin'] != 0.0:
-
- % if data['lastweek'][kpi]['margin'] is greaterthan(0.0):
- ▲${"%.2f" % data['lastweek'][kpi]['margin']} %
- % endif
- % if data['lastweek'][kpi]['margin'] is lessthan(0.0):
- ▼${"%.2f" % data['lastweek'][kpi]['margin']} %
- %endif
-
+ |
+
+ |
+
+
+ |
+
+
+ % endif
+
+
+
+ % for kpi in kpis:
+
+
+
+
+
+ |
+ ${object.fields_get()[kpi]['string']}
+ %if kpi in kpi_actions:
+ View
+ %endif
+ |
+
+
+
+
+
+
+ ${data['yesterday'][kpi][kpi]}
+ Yesterday
+ % if data['yesterday'][kpi]['margin'] != 0.0:
+ % if data['yesterday'][kpi]['margin'] is greaterthan(0.0):
+
+ ▲ ${"%.2f" % data['yesterday'][kpi]['margin']}
+
+ %endif
+ % if data['yesterday'][kpi]['margin'] is lessthan(0.0):
+
+ ▼ ${"%.2f" % data['yesterday'][kpi]['margin']}
+
+ %endif
%endif
|
-
-
- |
-
-
-
-
- ${data['lastmonth'][kpi][kpi]}
- Last 30 Days
+ |
+ ${data['lastweek'][kpi][kpi]}
+ Last 7 Days
+ % if data['lastweek'][kpi]['margin'] != 0.0:
+ % if data['lastweek'][kpi]['margin'] is greaterthan(0.0):
+
+ ▲ ${"%.2f" % data['lastweek'][kpi]['margin']}
+
+ %endif
+ % if data['lastweek'][kpi]['margin'] is lessthan(0.0):
+
+ ▼ ${"%.2f" % data['lastweek'][kpi]['margin']}
+
+ %endif
+ %endif
+ |
+
+ ${data['lastmonth'][kpi][kpi]}
+ Last 30 Days
% if data['lastmonth'][kpi]['margin'] != 0.0:
-
- % if data['lastmonth'][kpi]['margin'] is greaterthan(0.0):
- ▲${"%.2f" % data['lastmonth'][kpi]['margin']} %
- % endif
- % if data['lastmonth'][kpi]['margin'] is lessthan(0.0):
- ▼${"%.2f" % data['lastmonth'][kpi]['margin']} %
- %endif
-
+ % if data['lastmonth'][kpi]['margin'] is greaterthan(0.0):
+
+ ▲ ${"%.2f" % data['lastmonth'][kpi]['margin']}
+
+ %endif
+ % if data['lastmonth'][kpi]['margin'] is lessthan(0.0):
+
+ ▼ ${"%.2f" % data['lastmonth'][kpi]['margin']}
+
+ %endif
%endif
|
@@ -113,52 +136,62 @@
- % endfor
- % if tips:
-
+ % endfor
+ % if user.has_group('base.group_system'):
+
- % endif
-
-
-
- Run your business from anywhere with Odoo Mobile.
- |
-
-
-
-  
-
- |
-
-
-
-
-
- % if user.has_group('base.group_system'):
-
-
- % endif
-
-
- Sent by
- Odoo - Unsubscribe
-
-
- |
-
-
-
-
-
+ % endif
+ |
+
+
+ |
+
+ |
+
+
+
+
+
+ | ${company.name} |
+
+
+ | Powered by Odoo. |
+
+
+ | |
+
+
+ |
+
+
+
+
${user.lang}
-
+
diff --git a/addons/digest/data/digest_tips_data.xml b/addons/digest/data/digest_tips_data.xml
new file mode 100644
index 00000000000..375dd660681
--- /dev/null
+++ b/addons/digest/data/digest_tips_data.xml
@@ -0,0 +1,59 @@
+
+
+
+
+ Weekly Stats in Odoo
+
+
+ True
+ True
+
+
+
+
+
+ Mail: ping colleagues
+ 1
+
+
+ % set users = object.env['res.users'].search([('share', '=' , False)], limit=10, order='id desc')
+ % set channel_id = object.env.ref('mail.channel_all_employees').id
+ Did you know...?
+ You can ping colleagues by tagging them in your messages using "@". They will be instantly notified.
+
+
+
+
+
+
+ Mail: get things done with activities
+ 7
+
+
+ Get things done with activities
+ You don't have any activity scheduled. Use activities on any business document to schedule meetings, calls and todos.
+
+ 
+
+
+
+
+
+
+ Mail: apps videos tour
+
+ 0
+
+
+ To reach your full potential with Odoo, have a look at our apps videos and discover new tools to work better and faster.
+
+
+
+
+
+
diff --git a/addons/digest/models/digest.py b/addons/digest/models/digest.py
index 609f7198478..4b33ebc7937 100644
--- a/addons/digest/models/digest.py
+++ b/addons/digest/models/digest.py
@@ -101,10 +101,20 @@ class Digest(models.Model):
def action_send(self):
for digest in self:
for user in digest.user_ids:
- subject = '%s: %s' % (user.company_id.name, digest.name)
- digest.template_id.with_context(user=user).send_mail(digest.id, force_send=True, raise_exception=True, email_values={'email_to': user.email, 'subject': subject})
+ digest._action_send_to_user(user, tips_count=1)
digest.next_run_date = digest._get_next_run_date()
+ def _action_send_to_user(self, user, tips_count=1):
+ subject = '%s: %s' % (user.company_id.name, self.name)
+ self.template_id.with_context(user=user, tips_count=tips_count).send_mail(
+ self.id,
+ force_send=True,
+ notif_layout="digest.digest_mail_layout",
+ raise_exception=True,
+ email_values={
+ 'email_to': user.email, 'subject': subject
+ }
+ )
@api.model
def _cron_send_digest_email(self):
@@ -148,15 +158,17 @@ class Digest(models.Model):
res.update({tf_name: kpis})
return res
- def compute_tips(self, company, user):
- tip = self.env['digest.tip'].search([('user_ids', '!=', user.id), '|', ('group_id', 'in', user.groups_id.ids), ('group_id', '=', False)], limit=1)
- if not tip:
- return False
- tip.user_ids += user
- body = tools.html_sanitize(tip.tip_description)
- # FIXME: sanitize ? links ?
- tip_description = self.env['mail.render.mixin']._render_template(body, 'digest.tip', self.ids)[self.id]
- return tip_description
+ def compute_tips(self, company, user, tips_count=1):
+ tips = self.env['digest.tip'].search([
+ ('user_ids', '!=', user.id),
+ '|', ('group_id', 'in', user.groups_id.ids), ('group_id', '=', False)
+ ], limit=tips_count)
+ tip_descriptions = [
+ self.env['mail.render.mixin']._render_template(tools.html_sanitize(tip.tip_description), 'digest.tip', tip.ids, post_process=True)[tip.id]
+ for tip in tips
+ ]
+ # tip.user_ids += user
+ return tip_descriptions
def compute_kpis_actions(self, company, user):
""" Give an optional action to display in digest email linked to some KPIs.
| | | | |