[MIG] mail_activity_board: Migration to 14.0

[FIX] add title to <i> tag and removed console.log in js

Co-authored-by: Miquel Raïch <miquel.raich@forgeflow.com>

Co-authored-by: Miquel Raïch <miquel.raich@forgeflow.com>
This commit is contained in:
Atchuthan, Sodexis 2021-01-22 15:06:00 +05:30 committed by augusto-weiss
parent ddf0ea4d1e
commit c3326b92cc
10 changed files with 92 additions and 58 deletions

View File

@ -1,16 +1,17 @@
# Copyright 2018 David Juaneda - <djuaneda@sdi.es>
# Copyright 2021 Sodexis
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
{
"name": "Mail Activity Board",
"summary": "Add Activity Boards",
"version": "13.0.1.0.1",
"version": "14.0.1.0.0",
"development_status": "Beta",
"category": "Social Network",
"website": "https://github.com/OCA/social",
"author": "SDi, David Juaneda, Odoo Community Association (OCA)",
"author": "SDi, David Juaneda, Sodexis, Odoo Community Association (OCA)",
"license": "AGPL-3",
"installable": True,
"depends": ["calendar", "board"],
"data": ["views/templates.xml", "views/mail_activity_view.xml"],
"qweb": ["static/src/xml/inherit_chatter.xml"],
"qweb": ["static/src/components/chatter_topbar/chatter_topbar.xml"],
}

View File

@ -1,5 +1,5 @@
# Copyright 2018 David Juaneda - <djuaneda@sdi.es>
# Copyright 2018 Eficent Business and IT Consulting Services, S.L.
# Copyright 2018 ForgeFlow S.L. <https://www.forgeflow.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo import api, fields, models

View File

@ -1,4 +1,5 @@
# Copyright 2018 David Juaneda - <djuaneda@sdi.es>
# Copyright 2021 Sodexis
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo import models
@ -21,6 +22,7 @@ class MailActivityMixin(models.AbstractModel):
:return: action.
"""
_id = kwargs.get("id")
model = kwargs.get("model")
action = self.env["mail.activity"].action_activities_board()
views = []
for v in action["views"]:
@ -28,5 +30,5 @@ class MailActivityMixin(models.AbstractModel):
v = (v[0], "list")
views.append(v)
action["views"] = views
action["domain"] = [("res_id", "=", _id)]
action["domain"] = [("res_id", "=", _id), (("res_model", "=", model))]
return action

View File

@ -2,9 +2,9 @@
* David Juaneda
* `Eficent <https://www.eficent.com>`_:
* `ForgeFlow <https://www.forgeflow.com>`_:
* Miquel Raïch (miquel.raich@eficent.com)
* Miquel Raïch (miquel.raich@forgeflow.com)
* `Pesol <https://www.pesol.es>`_:

View File

@ -0,0 +1,57 @@
/* Copyright 2018 David Juaneda
* Copyright 2021 Sodexis
* License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). */
odoo.define(
"mail_activity_board/static/src/components/chatter_topbar/chatter_topbar.js",
function (require) {
"use strict";
var rpc = require("web.rpc");
const components = {
ChatterTopbar: require("mail/static/src/components/chatter_topbar/chatter_topbar.js"),
};
const {patch} = require("web.utils");
patch(
components.ChatterTopbar,
"mail_activity_board/static/src/components/chatter_topbar/chatter_topbar.js",
{
// --------------------------------------------------------------------------
// Handlers
// --------------------------------------------------------------------------
/**
* @private
* @param {MouseEvent} ev
*/
// eslint-disable-next-line no-unused-vars
_onListActivity(ev) {
var self = this;
rpc.query({
model: this.chatter.thread.model,
method: "redirect_to_activities",
args: [[]],
kwargs: {
id: this.chatter.thread.id,
model: this.chatter.thread.model,
},
context: {},
}).then(function (action) {
self.env.bus.trigger("do-action", {
action,
options: {
on_close: () => {
this.chatter.thread.refreshActivities();
this.chatter.thread.refresh();
},
},
});
});
},
}
);
}
);

View File

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8" ?>
<templates xml:space="preserve">
<t t-inherit="mail.ChatterTopbar" t-inherit-mode="extension">
<xpath
expr="//*[@class='btn btn-link o_ChatterTopbar_button o_ChatterTopbar_buttonScheduleActivity']"
position="after"
>
<button
class="btn btn-link o_ChatterTopbar_button o_ChatterTopbar_buttonListActivity"
type="button"
t-att-disabled="chatter.isDisabled"
t-on-click="_onListActivity"
>
<i class="fa fa-list" />Activities
</button>
</xpath>
</t>
</templates>

View File

@ -1,31 +0,0 @@
/* Copyright 2018 David Juaneda
* License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). */
odoo.define("mail.Chatter.activity", function (require) {
"use strict";
var chatter = require("mail.Chatter");
chatter.include({
events: _.extend({}, chatter.prototype.events, {
"click .o_chatter_button_list_activity": "_onListActivity",
}),
/**
* Performs the action to redirect to the activities of the object.
*
* @private
*/
_onListActivity: function () {
this._rpc({
model: this.record.model,
method: "redirect_to_activities",
args: [[]],
kwargs: {
id: this.record.res_id,
model: this.record.model,
},
context: this.record.getContext(),
}).then($.proxy(this, "do_action"));
},
});
});

View File

@ -1,18 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<templates id="template" xml:space="preserve">
<t t-extend="mail.chatter.Buttons">
<t t-jquery="button.o_chatter_button_schedule_activity" t-operation="after">
<button
t-if="scheduleActivityButton"
class="btn btn-link o_chatter_button_list_activity"
title="See activities list"
type="button"
disabled="disabled"
>
<i class="fa fa-list" /> Activities
</button>
</t>
</t>
</templates>

View File

@ -144,6 +144,7 @@
/>
<t t-if="act_date &lt; (new Date())">
<span t-attf-class="text-danger"><i
title="date"
class="fa fa-clock-o"
/></span>
<t
@ -166,7 +167,10 @@
</t>
</t>
<t t-else="">
<span><i class="fa fa-clock-o" /></span>
<span><i
title="date"
class="fa fa-clock-o"
/></span>
<t
t-if="record.activity_category.raw_value!='meeting'"
>

View File

@ -8,7 +8,7 @@
<xpath expr="." position="inside">
<script
type="text/javascript"
src="/mail_activity_board/static/src/js/override_chatter.js"
src="/mail_activity_board/static/src/components/chatter_topbar/chatter_topbar.js"
/>
</xpath>
</template>