-
-
Notifications
You must be signed in to change notification settings - Fork 615
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[MIG] mail_activity_team: Migration to 15.0
- Loading branch information
1 parent
c1c26b7
commit 250eaef
Showing
10 changed files
with
182 additions
and
141 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,30 @@ | ||
# Copyright 2018 Eficent Business and IT Consulting Services, S.L. | ||
# Copyright 2018-22 ForgeFlow Business and IT Consulting Services, S.L. | ||
# Copyright 2021 Sodexis | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). | ||
{ | ||
"name": "Mail Activity Team", | ||
"summary": "Add Teams to Activities", | ||
"version": "14.0.1.0.0", | ||
"version": "15.0.1.0.0", | ||
"development_status": "Alpha", | ||
"category": "Social Network", | ||
"website": "https://github.com/OCA/social", | ||
"author": "Eficent, Sodexis, Odoo Community Association (OCA)", | ||
"author": "ForgeFlow, Sodexis, Odoo Community Association (OCA)", | ||
"license": "AGPL-3", | ||
"installable": True, | ||
"depends": ["mail_activity_board"], | ||
"data": [ | ||
"views/assets_backend.xml", | ||
"security/ir.model.access.csv", | ||
"security/mail_activity_team_security.xml", | ||
"views/mail_activity_team_views.xml", | ||
"views/mail_activity_views.xml", | ||
"views/res_users_views.xml", | ||
], | ||
"qweb": [ | ||
"static/src/xml/systray.xml", | ||
], | ||
"assets": { | ||
"web.assets_backend": [ | ||
"mail_activity_team/static/src/js/systray.esm.js", | ||
], | ||
"web.assets_qweb": [ | ||
"mail_activity_team/static/src/xml/systray.xml", | ||
], | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,9 @@ | ||
* `Eficent <https://www.eficent.com>`_: | ||
* `ForgeFlow <https://www.forgeflow.com>`_: | ||
|
||
* Jordi Ballester Alomar (jordi.ballester@eficent.com) | ||
* Miquel Raïch (miquel.raich@eficent.com) | ||
* Pedro Gonzalez (pedro.gonzalez@pesol.es) | ||
* Bernat Puig Font (bernat.puig@forgeflow.com) | ||
* Pedro Gonzalez (pedro.gonzalez@pesol.es) | ||
* `Tecnativa <https://www.tecnativa.com>`_: | ||
|
||
* David Vidal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
* In next version systray.esm.js file should be changed as added in comments. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,150 @@ | ||
/** @odoo-module **/ | ||
import ActivityMenu from "@mail/js/systray/systray_activity_menu"; | ||
import {qweb as QWeb} from "web.core"; | ||
import {session} from "@web/session"; | ||
import Time from "web.time"; | ||
|
||
ActivityMenu.include({ | ||
events: _.extend({}, ActivityMenu.prototype.events, { | ||
"click .o_filter_button": "_onClickFilterButton", | ||
}), | ||
start: function () { | ||
this._super.apply(this, arguments); | ||
this.$filter_buttons = this.$(".o_filter_button"); | ||
this.$my_activities = this.$filter_buttons.first(); | ||
this.filter = "my"; | ||
session.user_context = _.extend({}, session.user_context, { | ||
team_activities: false, | ||
}); | ||
}, | ||
|
||
_updateCounter: function () { | ||
this._super.apply(this, arguments); | ||
this.$(".o_notification_counter").text(this.activityCounter); | ||
}, | ||
|
||
_onClickFilterButton: function (event) { | ||
var self = this; | ||
event.stopPropagation(); | ||
self.$filter_buttons.removeClass("active"); | ||
var $target = $(event.currentTarget); | ||
$target.addClass("active"); | ||
self.filter = $target.data("filter"); | ||
|
||
session.user_context = _.extend({}, session.user_context, { | ||
team_activities: self.filter === "team", | ||
}); | ||
|
||
/* | ||
If systray_activity_menu.js session import is like -> import { session } from "@web/session"; | ||
_rpc function below can be replaced with: | ||
self._updateActivityPreview(); | ||
*/ | ||
self._rpc({ | ||
model: "res.users", | ||
method: "systray_get_activities", | ||
args: [], | ||
kwargs: {context: session.user_context}, | ||
}) | ||
.then(function (data) { | ||
self._activities = data; | ||
self.activityCounter = _.reduce( | ||
data, | ||
function (total_count, p_data) { | ||
return total_count + p_data.total_count || 0; | ||
}, | ||
0 | ||
); | ||
self.$(".o_notification_counter").text(self.activityCounter); | ||
self.$el.toggleClass("o_no_notification", !self.activityCounter); | ||
}) | ||
.then(function () { | ||
self._$activitiesPreview.html( | ||
QWeb.render("mail.systray.ActivityMenu.Previews", { | ||
widget: self, | ||
Time: Time, | ||
}) | ||
); | ||
}); | ||
}, | ||
_onActivityFilterClick: function (event) { | ||
if (this.filter === "my") { | ||
this._super.apply(this, arguments); | ||
} | ||
if (this.filter === "team") { | ||
var data = _.extend( | ||
{}, | ||
$(event.currentTarget).data(), | ||
$(event.target).data() | ||
); | ||
var context = {}; | ||
if (data.filter === "my") { | ||
context.search_default_activities_overdue = 1; | ||
context.search_default_activities_today = 1; | ||
} else { | ||
context["search_default_activities_" + data.filter] = 1; | ||
} | ||
this.do_action({ | ||
type: "ir.actions.act_window", | ||
name: data.model_name, | ||
res_model: data.res_model, | ||
views: [ | ||
[false, "kanban"], | ||
[false, "form"], | ||
], | ||
search_view_id: [false], | ||
domain: [["activity_team_user_ids", "in", session.uid]], | ||
context: context, | ||
}); | ||
} | ||
}, | ||
/* | ||
If systray_activity_menu.js session import is like -> import { session } from "@web/session"; | ||
_rpc function below can be replaced with: | ||
self._super.apply(self, arguments) | ||
*/ | ||
_getActivityData: function () { | ||
var self = this; | ||
return self | ||
._rpc({ | ||
model: "res.users", | ||
method: "systray_get_activities", | ||
args: [], | ||
kwargs: {context: session.user_context}, | ||
}) | ||
.then(function (data) { | ||
self._activities = data; | ||
self.activityCounter = _.reduce( | ||
data, | ||
function (total_count, p_data) { | ||
return total_count + p_data.total_count || 0; | ||
}, | ||
0 | ||
); | ||
self.$(".o_notification_counter").text(self.activityCounter); | ||
self.$el.toggleClass("o_no_notification", !self.activityCounter); | ||
}) | ||
.then(function () { | ||
self._rpc({ | ||
model: "res.users", | ||
method: "systray_get_activities", | ||
args: [], | ||
kwargs: { | ||
context: session.user_context, | ||
}, | ||
}).then(function (data) { | ||
if (!session.user_context) { | ||
self.activityCounter += _.reduce( | ||
data, | ||
function (total_count, p_data) { | ||
return total_count + p_data.total_count || 0; | ||
}, | ||
0 | ||
); | ||
} | ||
self.$(".o_notification_counter").text(self.activityCounter); | ||
self.$el.toggleClass("o_no_notification", !self.activityCounter); | ||
}); | ||
}); | ||
}, | ||
}); |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.