diff --git a/addons/gamification/static/src/js/gamification.js b/addons/gamification/static/src/js/gamification.js index 37a4f334e78..37ba574ff19 100644 --- a/addons/gamification/static/src/js/gamification.js +++ b/addons/gamification/static/src/js/gamification.js @@ -119,12 +119,4 @@ var Sidebar = Widget.extend({ } }); -mail.TimelineView.include({ - start: function() { - this._super(); - var sidebar = new Sidebar(this); - sidebar.appendTo($('.o_timeline__inbox_aside')); - }, -}); - }); diff --git a/addons/hr/__openerp__.py b/addons/hr/__openerp__.py index 27319346415..e89a997e4c7 100644 --- a/addons/hr/__openerp__.py +++ b/addons/hr/__openerp__.py @@ -46,7 +46,6 @@ You can manage: 'hr_tip_data.xml', 'res_config_view.xml', 'mail_hr_view.xml', - 'res_users_view.xml', 'views/hr.xml', 'hr_dashboard.xml', ], @@ -59,5 +58,5 @@ You can manage: 'installable': True, 'application': True, 'auto_install': False, - 'qweb': ['static/src/xml/suggestions.xml'], + 'qweb': [], } diff --git a/addons/hr/hr.py b/addons/hr/hr.py index 7e8860477c8..4c90051b7d1 100644 --- a/addons/hr/hr.py +++ b/addons/hr/hr.py @@ -266,15 +266,6 @@ class hr_employee(osv.osv): that receive the context without the wrapper. """ return self.message_unsubscribe_users(cr, uid, ids, context=context) - def get_suggested_thread(self, cr, uid, removed_suggested_threads=None, context=None): - """Show the suggestion of employees if display_employees_suggestions if the - user perference allows it. """ - user = self.pool.get('res.users').browse(cr, uid, uid, context) - if not user.display_employees_suggestions: - return [] - else: - return super(hr_employee, self).get_suggested_thread(cr, uid, removed_suggested_threads, context) - def _message_get_auto_subscribe_fields(self, cr, uid, updated_fields, auto_follow_fields=None, context=None): """ Overwrite of the original method to always follow user_id field, even when not track_visibility so that a user will follow it's employee diff --git a/addons/hr/res_users.py b/addons/hr/res_users.py index c223ee2e9f3..0b1994f3ab5 100644 --- a/addons/hr/res_users.py +++ b/addons/hr/res_users.py @@ -13,34 +13,8 @@ class res_users(osv.Model): _columns = { 'employee_ids': fields.one2many('hr.employee', 'user_id', 'Related employees'), - 'display_employees_suggestions': fields.boolean("Display Employees Suggestions"), } - _defaults = { - 'display_employees_suggestions': True, - } - - def __init__(self, pool, cr): - """ Override of __init__ to add access rights on - display_employees_suggestions fields. Access rights are disabled by - default, but allowed on some specific fields defined in - self.SELF_{READ/WRITE}ABLE_FIELDS. - """ - init_res = super(res_users, self).__init__(pool, cr) - # duplicate list to avoid modifying the original reference - self.SELF_WRITEABLE_FIELDS = list(self.SELF_WRITEABLE_FIELDS) - self.SELF_WRITEABLE_FIELDS.append('display_employees_suggestions') - # duplicate list to avoid modifying the original reference - self.SELF_READABLE_FIELDS = list(self.SELF_READABLE_FIELDS) - self.SELF_READABLE_FIELDS.append('display_employees_suggestions') - return init_res - - def stop_showing_employees_suggestions(self, cr, uid, user_id, context=None): - """Update display_employees_suggestions value to False""" - if context is None: - context = {} - self.write(cr, uid, user_id, {"display_employees_suggestions": False}, context) - def _message_post_get_eid(self, cr, uid, thread_id, context=None): assert thread_id, "res.users does not support posting global messages" if context and 'thread_model' in context: diff --git a/addons/hr/res_users_view.xml b/addons/hr/res_users_view.xml deleted file mode 100644 index 0843269e716..00000000000 --- a/addons/hr/res_users_view.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - res.users.form.hr - res.users - - - - - - - - - - - - diff --git a/addons/hr/static/src/js/suggestions.js b/addons/hr/static/src/js/suggestions.js deleted file mode 100644 index 14a8a72867e..00000000000 --- a/addons/hr/static/src/js/suggestions.js +++ /dev/null @@ -1,83 +0,0 @@ -odoo.define('hr.suggestions', function (require) { -"use strict"; - -var mail = require('mail.mail'); -var core = require('web.core'); -var data = require('web.data'); -var Widget = require('web.Widget'); - -var QWeb = core.qweb; - -var removed_suggested_employee = []; - -var Employees = Widget.extend({ - events: { - 'click .oe_suggestion_remove.oe_suggestion_employee': 'stop_employee_suggestion', - 'click .oe_suggestion_remove_item.oe_suggestion_employee': 'remove_employee_suggestion', - 'click .oe_suggestion_follow': 'follow_employee', - }, - - init: function () { - this._super(this, arguments); - this.hr_employee = new data.DataSetSearch(this, 'hr.employee'); - this.res_users = new data.DataSetSearch(this, 'res.users'); - this.employees = []; - }, - - start: function () { - this._super.apply(this, arguments); - return this.fetch_suggested_employee(); - }, - - fetch_suggested_employee: function () { - var self = this; - var employee = self.hr_employee.call('get_suggested_thread', {'removed_suggested_threads': removed_suggested_employee}).then(function (res) { - _(res).each(function (result) { - result['image']=self.session.url('/web/binary/image', {model: 'hr.employee', field: 'image_small', id: result.id}); - }); - self.employees = res; - }); - return $.when(employee).done(this.proxy('display_suggested_employees')); - }, - - display_suggested_employees: function () { - var suggested_employees = this.$('.oe_sidebar_suggestion.oe_suggestion_employee'); - if (suggested_employees) { - suggested_employees.remove(); - } - if (this.employees.length === 0) { - return this.$el.empty(); - } - return this.$el.empty().html(QWeb.render('hr.suggestions.employees', {'widget': this})); - }, - - follow_employee: function (event) { - var self = this; - var employee_id = parseInt($(event.currentTarget).attr('id'), 10); - return this.hr_employee.call('message_subscribe_users', [[employee_id], [this.session.uid], undefined]).then(function(res) { - self.fetch_suggested_employee(); - }); - }, - - remove_employee_suggestion: function (event) { - removed_suggested_employee.push($(event.currentTarget).attr('id')); - return this.fetch_suggested_employee(); - }, - - stop_employee_suggestion: function (event) { - var self = this; - return this.res_users.call('stop_showing_employees_suggestions', [this.session.uid]).then(function(res) { - self.$(".oe_sidebar_suggestion.oe_suggestion_employee").hide(); - }); - } -}); - -mail.Sidebar.include({ - start: function () { - this._super.apply(this, arguments); - var sug_employees = new Employees(this); - return sug_employees.appendTo(this.$('.oe_suggestions_employees')); - }, -}); - -}); diff --git a/addons/hr/static/src/xml/suggestions.xml b/addons/hr/static/src/xml/suggestions.xml deleted file mode 100644 index 8856e7ab3a4..00000000000 --- a/addons/hr/static/src/xml/suggestions.xml +++ /dev/null @@ -1,36 +0,0 @@ - - diff --git a/addons/hr/views/hr.xml b/addons/hr/views/hr.xml index e76ec3cc4ce..b5444ed70a6 100644 --- a/addons/hr/views/hr.xml +++ b/addons/hr/views/hr.xml @@ -5,7 +5,6 @@ - diff --git a/addons/mail/__openerp__.py b/addons/mail/__openerp__.py index 62a84ed26eb..9498a068dda 100644 --- a/addons/mail/__openerp__.py +++ b/addons/mail/__openerp__.py @@ -61,6 +61,5 @@ Main Features 'static/src/xml/mail.xml', 'static/src/xml/mail_followers.xml', 'static/src/xml/announcement.xml', - 'static/src/xml/suggestions.xml', ], } diff --git a/addons/mail/models/mail_group.py b/addons/mail/models/mail_group.py index 44e92584025..a16637481d1 100644 --- a/addons/mail/models/mail_group.py +++ b/addons/mail/models/mail_group.py @@ -164,14 +164,6 @@ class MailGroup(models.Model): that receive the context without the wrapper. """ return self.message_unsubscribe_users() - @api.model - def get_suggested_thread(self, removed_suggested_threads=None): - """Show the suggestion of groups if display_groups_suggestions if the - user perference allows it.""" - if not self.env.user.display_groups_suggestions: - return [] - return super(MailGroup, self).get_suggested_thread(removed_suggested_threads) - @api.multi def message_get_email_values(self, notif_mail=None): self.ensure_one() diff --git a/addons/mail/models/mail_thread.py b/addons/mail/models/mail_thread.py index 09310d47578..8499ce7d35a 100644 --- a/addons/mail/models/mail_thread.py +++ b/addons/mail/models/mail_thread.py @@ -1840,29 +1840,6 @@ class MailThread(models.AbstractModel): self.env['mail.notification'].invalidate_cache(['is_read']) return True - @api.model - def get_suggested_thread(self, removed_suggested_threads=None): - """Return a list of suggested threads, sorted by the numbers of followers""" - # TDE HACK: originally by MAT from portal/mail_mail.py but not working until the inheritance graph bug is not solved in trunk - # TDE FIXME: relocate in portal when it won't be necessary to reload the hr.employee model in an additional bridge module - if 'is_portal' in self.pool['res.groups']._fields: - if any(group.is_portal for group in self.env.user.sudo().groups_id): - return [] - - threads = [] - if removed_suggested_threads is None: - removed_suggested_threads = [] - - for thread in self.search([('id', 'not in', removed_suggested_threads), ('message_is_follower', '=', False)]): - data = { - 'id': thread.id, - 'popularity': len(thread.message_follower_ids), - 'name': thread.name, - 'image_small': thread.image_small - } - threads.append(data) - return sorted(threads, key=lambda x: (x['popularity'], x['id']), reverse=True)[:3] - @api.multi def message_change_thread(self, new_thread): """ diff --git a/addons/mail/models/res_users.py b/addons/mail/models/res_users.py index e5ed3f423b6..17fc70f65d8 100644 --- a/addons/mail/models/res_users.py +++ b/addons/mail/models/res_users.py @@ -18,7 +18,6 @@ class Users(models.Model): alias_id = fields.Many2one('mail.alias', 'Alias', ondelete="restrict", required=True, help="Email address internally associated with this user. Incoming "\ "emails will appear in the user's notifications.", copy=False, auto_join=True) - display_groups_suggestions = fields.Boolean("Display Groups Suggestions", default=True) def __init__(self, pool, cr): """ Override of __init__ to add access rights on notification_email_send @@ -28,10 +27,10 @@ class Users(models.Model): init_res = super(Users, self).__init__(pool, cr) # duplicate list to avoid modifying the original reference self.SELF_WRITEABLE_FIELDS = list(self.SELF_WRITEABLE_FIELDS) - self.SELF_WRITEABLE_FIELDS.extend(['notify_email', 'display_groups_suggestions']) + self.SELF_WRITEABLE_FIELDS.extend(['notify_email']) # duplicate list to avoid modifying the original reference self.SELF_READABLE_FIELDS = list(self.SELF_READABLE_FIELDS) - self.SELF_READABLE_FIELDS.extend(['notify_email', 'alias_domain', 'alias_name', 'display_groups_suggestions']) + self.SELF_READABLE_FIELDS.extend(['notify_email', 'alias_domain', 'alias_name']) return init_res def _auto_init(self, cr, context=None): @@ -123,9 +122,6 @@ class Users(models.Model): def message_get_suggested_recipients(self): return dict((res_id, list()) for res_id in self._ids) - def stop_showing_groups_suggestions(self): - self.write({"display_groups_suggestions": False}) - class res_users_mail_group(models.Model): """ Update of res.users class diff --git a/addons/mail/static/src/css/mail.css b/addons/mail/static/src/css/mail.css index 8090643eb57..2c656641f76 100644 --- a/addons/mail/static/src/css/mail.css +++ b/addons/mail/static/src/css/mail.css @@ -1018,90 +1018,3 @@ border-bottom: 1px solid #dddddd; margin-bottom: 10px; } - - -/* ----------------------- SIDEBAR ----------------------- */ - - .o_web_client .o_timeline .o_timeline_inbox_aside { - margin-left: 10px; - margin-top: 5px; - position: relative; - display: inline-block; - vertical-align: top; - width: 200px; - } - - .o_web_client .o_timeline .o_timeline_inbox_aside .oe_sidebar_suggestion { - background-color: #f0eeee; - border: solid 1px #CACACA; - border-radius: 3px; - padding-top: 1px; - padding-bottom: 7px; - margin-bottom: 20px - } - - .o_web_client .o_timeline .o_timeline_inbox_aside .oe_suggest_title span { - background-color: #f0eeee; - display: inline-block; - height: 25px; - vertical-align: middle; - font-size: 14px; - font-weight: bold; - margin-left: 10px; - margin-top: -20px; - padding-left: 5px; - padding-right: 5px; - } - - .o_web_client .oe_sidebar_suggestion .oe_suggest_items .oe_suggested_item { - border-radius: 2px; - margin-left: 10px; - min-height: 67px; - white-space: nowrap; - } - - .o_web_client .oe_sidebar_suggestion .oe_suggest_items .oe_suggested_item_image { - float: left; - padding-right: 10px; - } - - .o_web_client .oe_sidebar_suggestion .oe_suggest_items .oe_suggested_item_image img { - border-radius: 2px; - border: solid 1px rgba(0,0,0,0.03); - } - - .o_web_client .oe_sidebar_suggestion .oe_suggest_items .oe_suggested_item_content button { - margin-top: 10px; - } - - .o_web_client .oe_sidebar_suggestion .oe_suggest_items .oe_suggested_item_content .oe_suggestion_item_name { - display: inline-block; - text-overflow: ellipsis; - overflow: hidden; - max-width: 110px; - } - - .o_web_client .o_timeline .o_timeline_inbox_aside a { - color: #337ab7; - } - - .o_web_client .oe_sidebar_suggestion .oe_suggest_title .oe_suggestion_remove { - line-height: 15px; - margin-top: -2px; - float: right; - visibility: hidden; - margin-right: 7px; - } - - .o_web_client .oe_sidebar_suggestion .oe_suggest_items .oe_suggested_item_content .oe_suggestion_remove_item { - line-height: 21px; - margin-top: -2px; - float: right; - visibility: hidden; - margin-right: 16px; - } - - .o_web_client .oe_sidebar_suggestion .oe_suggest_title:hover .oe_suggestion_remove, - .o_web_client .oe_sidebar_suggestion .oe_suggest_items:hover .oe_suggestion_remove_item { - visibility: visible; - } \ No newline at end of file diff --git a/addons/mail/static/src/js/mail.js b/addons/mail/static/src/js/mail.js index c6ebe4825eb..7ff2b77dc2d 100644 --- a/addons/mail/static/src/js/mail.js +++ b/addons/mail/static/src/js/mail.js @@ -129,12 +129,6 @@ var TimelineView = View.extend ({ this.has_been_loaded = $.Deferred(); }, - start: function () { - var wall_sidebar = new Sidebar(this); - wall_sidebar.appendTo(this.$('.o_timeline_inbox_aside')); - return this._super.apply(this, arguments); - }, - view_loading: function (fields_view_get) { return this.load_timeline(fields_view_get); }, @@ -1495,18 +1489,6 @@ var ComposeMessage = Attachment.extend ({ }, }); -/** - * ------------------------------------------------------------ - * Aside Widget - * ------------------------------------------------------------ - * - * This widget handles the display of a sidebar in the inbox. Its main - * use is to display group and employees suggestion (if hr is installed). - */ -var Sidebar = Widget.extend({ - template: 'TimelineSidebar', -}); - /** * ------------------------------------------------------------ * UserMenu @@ -1553,7 +1535,6 @@ return { TimelineView: TimelineView, MailThread: MailThread, TimelineRecordThread: TimelineRecordThread, - Sidebar: Sidebar, }; }); diff --git a/addons/mail/static/src/js/suggestions.js b/addons/mail/static/src/js/suggestions.js deleted file mode 100644 index 120fe6a22d8..00000000000 --- a/addons/mail/static/src/js/suggestions.js +++ /dev/null @@ -1,83 +0,0 @@ -odoo.define('mail.suggestion', function (require) { - -var mail = require('mail.mail'); -var core = require('web.core'); -var data = require('web.data'); -var real_session = require('web.session'); -var Widget = require('web.Widget'); - -var QWeb = core.qweb; - -var removed_suggested_group = []; - -var Groups = Widget.extend({ - events: { - 'click .oe_suggestion_remove.oe_suggestion_group': 'stop_group_suggestion', - 'click .oe_suggestion_remove_item.oe_suggestion_group': 'remove_group_suggestion', - 'click .oe_suggestion_join': 'join_group', - }, - - init: function () { - this._super.apply(this, arguments); - this.mail_group = new data.DataSetSearch(this, 'mail.group'); - this.res_users = new data.DataSetSearch(this, 'res.users'); - this.groups = []; - }, - - start: function () { - this._super.apply(this, arguments); - return this.fetch_suggested_groups(); - }, - - fetch_suggested_groups: function () { - var self = this; - var group = self.mail_group.call('get_suggested_thread', {'removed_suggested_threads': removed_suggested_group}).then(function (res) { - _(res).each(function (result) { - result.image = real_session.url('/web/binary/image', {model: 'mail.group', field: 'image_small', id: result.id}); - }); - self.groups = res; - }); - return $.when(group).then(this.proxy('display_suggested_groups')); - }, - - display_suggested_groups: function () { - var suggested_groups = this.$('.oe_sidebar_suggestion.oe_suggestion_group'); - if (suggested_groups) { - suggested_groups.empty(); - } - if (this.groups.length === 0) { - return this.$el.empty(); - } - return this.$el.empty().html(QWeb.render('TimelineSuggestionGroups', {'widget': this})); - }, - - join_group: function (event) { - var self = this; - var group_id = parseInt($(event.currentTarget).attr('id'), 10); - return this.mail_group.call('message_subscribe_users', [[group_id], [this.session.uid]]).then(function(res) { - self.fetch_suggested_groups(); - }); - }, - - remove_group_suggestion: function (event) { - removed_suggested_group.push($(event.currentTarget).attr('id')); - return this.fetch_suggested_groups(); - }, - - stop_group_suggestion: function (event) { - var self = this; - return this.res_users.call('stop_showing_groups_suggestions', [this.session.uid]).then(function(res) { - self.$(".oe_sidebar_suggestion.oe_suggestion_group").hide(); - }); - } -}); - -mail.Sidebar.include({ - start: function () { - this._super.apply(this, arguments); - var sug_groups = new Groups(this); - return sug_groups.appendTo(this.$('.oe_suggestions_groups')); - }, -}); - -}); \ No newline at end of file diff --git a/addons/mail/static/src/xml/mail.xml b/addons/mail/static/src/xml/mail.xml index d5a188f5e40..704263c239d 100644 --- a/addons/mail/static/src/xml/mail.xml +++ b/addons/mail/static/src/xml/mail.xml @@ -26,9 +26,6 @@
- - -
@@ -246,10 +243,6 @@
No message.
- -
-
- - - -
-
-
- - -
-
- - Suggested Groups -
-
- -
-
- - - -
-
- - -
-
- -
-
-
-
-
-
- - diff --git a/addons/mail/views/mail_templates.xml b/addons/mail/views/mail_templates.xml index a8ddba4c93a..eb126b3f063 100644 --- a/addons/mail/views/mail_templates.xml +++ b/addons/mail/views/mail_templates.xml @@ -11,7 +11,6 @@ - diff --git a/addons/mail/views/res_users_views.xml b/addons/mail/views/res_users_views.xml index 7bbe369c4d7..bee14dc64ec 100644 --- a/addons/mail/views/res_users_views.xml +++ b/addons/mail/views/res_users_views.xml @@ -50,7 +50,6 @@
-