diff --git a/addons/digest/data/digest_data.xml b/addons/digest/data/digest_data.xml index 76c6e373d80..91a8f2b2fcd 100644 --- a/addons/digest/data/digest_data.xml +++ b/addons/digest/data/digest_data.xml @@ -2,7 +2,7 @@ - Weekly Digest + Weekly Stats in Odoo True @@ -15,7 +15,7 @@ 1
- % set users = object.env['res.users'].search([], limit=10, order='id desc') + % 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.
@@ -41,5 +41,16 @@
+ + + + 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/data/digest_template_data.xml b/addons/digest/data/digest_template_data.xml index c333e76455c..07c0994edaf 100644 --- a/addons/digest/data/digest_template_data.xml +++ b/addons/digest/data/digest_template_data.xml @@ -3,8 +3,8 @@ Digest: Default main template - ${user.email_formatted | safe} ${'%s: %s' % (ctx.get('user', user).company_id.name, object.name)} + ${('%s' % (object.company_id.partner_id.email_formatted or user.email_formatted))|safe} @@ -17,12 +17,15 @@ % set kpis = data.yesterday.keys()
- -
- ${company.name} at a glance -
${datetime.date.today().strftime('%B %d, %Y')}
+
+ ${object.name} +
${datetime.date.today().strftime('%B %d, %Y')}
+ +
+ Connect +
@@ -53,10 +56,10 @@ Yesterday % if data['yesterday'][kpi]['margin'] != 0.0: - % 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'] < 0.0: + % if data['yesterday'][kpi]['margin'] is lessthan(0.0): ▼${"%.2f" % data['yesterday'][kpi]['margin']} % % endif @@ -73,10 +76,10 @@ Last 7 Days % if data['lastweek'][kpi]['margin'] != 0.0: - % 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'] <0.0: + % if data['lastweek'][kpi]['margin'] is lessthan(0.0): ▼${"%.2f" % data['lastweek'][kpi]['margin']} % %endif @@ -85,18 +88,18 @@
- + - - @@ -138,7 +141,7 @@
+ ${data['lastmonth'][kpi][kpi]}
Last 30 Days % if data['lastmonth'][kpi]['margin'] != 0.0: - % 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'] < 0.0: + % if data['lastmonth'][kpi]['margin'] is lessthan(0.0): ▼${"%.2f" % data['lastmonth'][kpi]['margin']} % %endif @@ -114,8 +117,8 @@ % if tips: -

-
${ctx['tip_description']|safe}
+

+
${tips | safe}
@@ -127,7 +130,7 @@
+
% if user.has_group('base.group_system'):
- Want to customize the email? + Want to customize this email? Choose the metrics you care about

diff --git a/addons/digest/models/digest.py b/addons/digest/models/digest.py index eb4fd1190bb..1d10c59d504 100644 --- a/addons/digest/models/digest.py +++ b/addons/digest/models/digest.py @@ -65,9 +65,10 @@ class Digest(models.Model): record.kpi_res_users_connected_value = user_connected def _compute_kpi_mail_message_total_value(self): + discussion_subtype_id = self.env.ref('mail.mt_comment').id for record in self: start, end, company = record._get_kpi_compute_parameters() - total_messages = self.env['mail.message'].search_count([('create_date', '>=',start), ('create_date', '<', end)]) + total_messages = self.env['mail.message'].search_count([('create_date', '>=', start), ('create_date', '<', end), ('subtype_id', '=', discussion_subtype_id), ('message_type', 'in', ['comment', 'email'])]) record.kpi_mail_message_total_value = total_messages @api.onchange('periodicity') @@ -181,19 +182,16 @@ class Digest(models.Model): return margin def _format_currency_amount(self, amount, currency_id): - pre = post = u'' - if currency_id.position == 'before': - pre = u'{symbol}\N{NO-BREAK SPACE}'.format(symbol=currency_id.symbol or '') - else: - post = u'\N{NO-BREAK SPACE}{symbol}'.format(symbol=currency_id.symbol or '') - return u'{pre}{0}{post}'.format(amount, pre=pre, post=post) + pre = currency_id.position == 'before' + symbol = u'{symbol}'.format(symbol=currency_id.symbol or '') + return u'{pre}{0}{post}'.format(amount, pre=symbol if pre else '', post=symbol if not pre else '') def _format_human_readable_amount(self, amount, suffix=''): for unit in ['', 'K', 'M', 'G']: if abs(amount) < 1000.0: - return "%3.1f%s%s" % (amount, unit, suffix) + return "%3.2f%s%s" % (amount, unit, suffix) amount /= 1000.0 - return "%.1f%s%s" % (amount, 'T', suffix) + return "%.2f%s%s" % (amount, 'T', suffix) @api.model def _cron_send_digest_email(self): diff --git a/addons/digest/views/digest_views.xml b/addons/digest/views/digest_views.xml index dc348837227..44bdfd355e7 100644 --- a/addons/digest/views/digest_views.xml +++ b/addons/digest/views/digest_views.xml @@ -45,7 +45,6 @@ - @@ -62,6 +61,16 @@ + + + + + + + + + +