Skip to content
Snippets Groups Projects
Commit 64297049 authored by Mahendra Barad's avatar Mahendra Barad Committed by Thibault Delavallée
Browse files

[REF] mail, note: rename systray method giving data for web client

As it becomes used to display more things than just counting activities let
us rename the method. Future commits will add new features in the systray
like meetings.

This commit is linked to task ID 60593.
parent 3239c917
Branches
Tags
No related merge requests found
......@@ -72,7 +72,7 @@ class Users(models.Model):
return write_res
@api.model
def activity_user_count(self):
def systray_get_activities(self):
query = """SELECT m.id, count(*), act.res_model as model,
CASE
WHEN %(today)s::date - act.date_deadline::date = 0 Then 'today'
......
......@@ -179,7 +179,7 @@ var ActivityMenu = Widget.extend({
return self._rpc({
model: 'res.users',
method: 'activity_user_count',
method: 'systray_get_activities',
kwargs: {
context: session.user_context,
},
......
......@@ -61,7 +61,7 @@ QUnit.test('activity menu widget: menu with no records', function (assert) {
testUtils.addMockEnvironment(activityMenu, {
services: this.services,
mockRPC: function (route, args) {
if (args.method === 'activity_user_count') {
if (args.method === 'systray_get_activities') {
return $.when([]);
}
return this._super(route, args);
......@@ -79,7 +79,7 @@ QUnit.test('activity menu widget: activity menu with 3 records', function (asser
testUtils.addMockEnvironment(activityMenu, {
services: this.services,
mockRPC: function (route, args) {
if (args.method === 'activity_user_count') {
if (args.method === 'systray_get_activities') {
return $.when(self.data['mail.activity.menu']['records']);
}
return this._super(route, args);
......
......@@ -49,12 +49,12 @@ GROUP BY id"""
_logger.info('Note default columns created for user id %s', user.id)
@api.model
def activity_user_count(self):
def systray_get_activities(self):
""" If user have not scheduled any note, it will not appear in activity menu.
Making note activity always visible with number of notes on label. If there is no notes,
activity menu not visible for note.
"""
activities = super(Users, self).activity_user_count()
activities = super(Users, self).systray_get_activities()
notes_count = self.env['note.note'].search_count([('user_id', '=', self.env.uid)])
if notes_count:
note_index = next((index for (index, a) in enumerate(activities) if a["model"] == "note.note"), None)
......
......@@ -26,7 +26,7 @@ QUnit.test('note activity menu widget: create note from activity menu', function
testUtils.addMockEnvironment(activityMenu, {
services: this.services,
mockRPC: function (route, args) {
if (args.method === 'activity_user_count') {
if (args.method === 'systray_get_activities') {
return $.when(self.data['mail.activity.menu']['records']);
}
if (route === '/note/new') {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment