[FIX] mail: remove non-owl t-raw
The Activity widget is apparently completely unused now that owl, so remove it, and its template
This commit is contained in:
@@ -45,7 +45,6 @@ If you need to manage your meetings, you should install the CRM module.
|
||||
'calendar/static/src/js/calendar_controller.js',
|
||||
'calendar/static/src/js/calendar_model.js',
|
||||
'calendar/static/src/js/calendar_view.js',
|
||||
'calendar/static/src/js/mail_activity.js',
|
||||
'calendar/static/src/js/systray_activity_menu.js',
|
||||
'calendar/static/src/js/services/calendar_notification_service.js',
|
||||
],
|
||||
|
||||
@@ -1,60 +0,0 @@
|
||||
odoo.define('calendar.Activity', function (require) {
|
||||
"use strict";
|
||||
|
||||
var Activity = require('@mail/js/activity')[Symbol.for("default")];
|
||||
var Dialog = require('web.Dialog');
|
||||
var core = require('web.core');
|
||||
var _t = core._t;
|
||||
|
||||
Activity.include({
|
||||
|
||||
/**
|
||||
* Override behavior to redirect to calendar event instead of activity
|
||||
*
|
||||
* @override
|
||||
*/
|
||||
_onEditActivity: function (event, options) {
|
||||
var self = this;
|
||||
var activity_id = $(event.currentTarget).data('activity-id');
|
||||
var activity = _.find(this.activities, function (act) { return act.id === activity_id; });
|
||||
if (activity && activity.activity_category === 'meeting' && activity.calendar_event_id) {
|
||||
return self._super(event, _.extend({
|
||||
res_model: 'calendar.event',
|
||||
res_id: activity.calendar_event_id[0],
|
||||
}));
|
||||
}
|
||||
return self._super(event, options);
|
||||
},
|
||||
|
||||
/**
|
||||
* Override behavior to warn that the calendar event is about to be removed as well
|
||||
*
|
||||
* @override
|
||||
*/
|
||||
_onUnlinkActivity: function (event, options) {
|
||||
event.preventDefault();
|
||||
var self = this;
|
||||
var activity_id = $(event.currentTarget).data('activity-id');
|
||||
var activity = _.find(this.activities, function (act) { return act.id === activity_id; });
|
||||
if (activity && activity.activity_category === 'meeting' && activity.calendar_event_id) {
|
||||
Dialog.confirm(
|
||||
self,
|
||||
_t("The activity is linked to a meeting. Deleting it will remove the meeting as well. Do you want to proceed ?"), {
|
||||
confirm_callback: function () {
|
||||
return self._rpc({
|
||||
model: 'mail.activity',
|
||||
method: 'unlink_w_meeting',
|
||||
args: [[activity_id]],
|
||||
})
|
||||
.then(self._reload.bind(self, {activity: true}));
|
||||
},
|
||||
}
|
||||
);
|
||||
}
|
||||
else {
|
||||
return self._super(event, options);
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
});
|
||||
@@ -539,109 +539,6 @@ var BasicActivity = AbstractField.extend({
|
||||
},
|
||||
});
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Activities Widget for Form views ('mail_activity' widget)
|
||||
// -----------------------------------------------------------------------------
|
||||
// FIXME seems to still be needed in some cases like systray
|
||||
var Activity = BasicActivity.extend({
|
||||
className: 'o_mail_activity',
|
||||
events: _.extend({}, BasicActivity.prototype.events, {
|
||||
'click a': '_onClickRedirect',
|
||||
}),
|
||||
specialData: '_fetchSpecialActivity',
|
||||
/**
|
||||
* @override
|
||||
*/
|
||||
init: function () {
|
||||
this._super.apply(this, arguments);
|
||||
this._activities = this.record.specialData[this.name];
|
||||
},
|
||||
/**
|
||||
* @override
|
||||
*/
|
||||
destroy: function () {
|
||||
this._unbindOnUploadAction();
|
||||
return this._super.apply(this, arguments);
|
||||
},
|
||||
|
||||
//------------------------------------------------------------
|
||||
// Private
|
||||
//------------------------------------------------------------
|
||||
/**
|
||||
* @private
|
||||
* @param {Object} fieldsToReload
|
||||
*/
|
||||
_reload: function (fieldsToReload) {
|
||||
this.trigger_up('reload_mail_fields', fieldsToReload);
|
||||
},
|
||||
/**
|
||||
* @override
|
||||
* @private
|
||||
*/
|
||||
_render: function () {
|
||||
_.each(this._activities, function (activity) {
|
||||
var note = mailUtils.parseAndTransform(activity.note || '', mailUtils.inline);
|
||||
var is_blank = (/^\s*$/).test(note);
|
||||
if (!is_blank) {
|
||||
activity.note = mailUtils.parseAndTransform(activity.note, mailUtils.addLink);
|
||||
} else {
|
||||
activity.note = '';
|
||||
}
|
||||
});
|
||||
var activities = setFileUploadID(setDelayLabel(this._activities));
|
||||
if (activities.length) {
|
||||
var nbActivities = _.countBy(activities, 'state');
|
||||
this.$el.html(QWeb.render('mail.activity_items', {
|
||||
uid: session.uid,
|
||||
activities: activities,
|
||||
nbPlannedActivities: nbActivities.planned,
|
||||
nbTodayActivities: nbActivities.today,
|
||||
nbOverdueActivities: nbActivities.overdue,
|
||||
dateFormat: time.getLangDateFormat(),
|
||||
datetimeFormat: time.getLangDatetimeFormat(),
|
||||
session: session,
|
||||
widget: this,
|
||||
}));
|
||||
this._bindOnUploadAction(this._activities);
|
||||
} else {
|
||||
this._unbindOnUploadAction(this._activities);
|
||||
this.$el.empty();
|
||||
}
|
||||
},
|
||||
/**
|
||||
* @override
|
||||
* @private
|
||||
* @param {Object} record
|
||||
*/
|
||||
_reset: function (record) {
|
||||
this._super.apply(this, arguments);
|
||||
this._activities = this.record.specialData[this.name];
|
||||
// the mail widgets being persistent, one need to update the res_id on reset
|
||||
this.res_id = record.res_id;
|
||||
},
|
||||
|
||||
//------------------------------------------------------------
|
||||
// Handlers
|
||||
//------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @param {MouseEvent} ev
|
||||
*/
|
||||
_onClickRedirect: function (ev) {
|
||||
var id = $(ev.currentTarget).data('oe-id');
|
||||
if (id) {
|
||||
ev.preventDefault();
|
||||
var model = $(ev.currentTarget).data('oe-model');
|
||||
this.trigger_up('redirect', {
|
||||
res_id: id,
|
||||
res_model: model,
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
});
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Activities Widget for Kanban views ('kanban_activity' widget)
|
||||
// -----------------------------------------------------------------------------
|
||||
@@ -861,5 +758,3 @@ field_registry
|
||||
.add('kanban_activity', KanbanActivity)
|
||||
.add('list_activity', ListActivity)
|
||||
.add('activity_exception', ActivityException);
|
||||
|
||||
export default Activity;
|
||||
|
||||
@@ -1,113 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<templates xml:space="preserve">
|
||||
<t t-name="mail.activity_items">
|
||||
<div class="o_thread_date_separator o_border_dashed" data-toggle="collapse" data-target="#o_chatter_planned_activities">
|
||||
<a role="button" class="o_thread_date btn">
|
||||
<i class="fa fa-fw fa-caret-down"/>
|
||||
Planned activities
|
||||
<small class="o_chatter_planned_activities_summary ml8">
|
||||
<span class="badge rounded-circle badge-danger"><t t-esc="nbOverdueActivities"/></span>
|
||||
<span class="badge rounded-circle badge-warning"><t t-esc="nbTodayActivities"/></span>
|
||||
<span class="badge rounded-circle badge-success"><t t-esc="nbPlannedActivities"/></span>
|
||||
</small>
|
||||
</a>
|
||||
</div>
|
||||
<div id="o_chatter_planned_activities" class="collapse show">
|
||||
<t t-foreach="activities" t-as="activity">
|
||||
<div class="o_thread_message" style="margin-bottom: 10px">
|
||||
<div class="o_thread_message_sidebar">
|
||||
<div class="o_avatar_stack">
|
||||
<img t-attf-src="/web/image#{activity.user_id[0] >= 0 ? ('/res.users/' + activity.user_id[0] + '/avatar_128') : ''}" class="o_thread_message_avatar rounded-circle mb8" t-att-title="activity.user_id[1]" t-att-alt="activity.user_id[1]"/>
|
||||
<i t-att-class="'o_avatar_icon fa ' + activity.icon + ' bg-' + (activity.state == 'planned'? 'success' : (activity.state == 'today'? 'warning' : 'danger'))"
|
||||
t-att-title="activity.activity_type_id[1]"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="o_thread_message_core">
|
||||
<div class="o_mail_info text-muted">
|
||||
<strong><span t-attf-class="o_activity_date o_activity_color_#{activity.state}"><t t-esc="activity.label_delay" /></span></strong>:
|
||||
<strong t-if="activity.summary" class="o_activity_summary"> “<t t-esc="activity.summary"/>”</strong>
|
||||
<strong t-if="!activity.summary"> <t t-esc="activity.activity_type_id[1]" /></strong>
|
||||
<em> for </em>
|
||||
<t t-esc="activity.user_id[1]" />
|
||||
<a class="btn btn-link btn-info text-muted collapsed o_activity_info ml4" role="button" data-toggle="collapse" t-attf-data-target="#o_chatter_activity_info_#{activity.id}">
|
||||
<i class="fa fa-info-circle" role="img" aria-label="Info" title="Info"></i>
|
||||
</a>
|
||||
<div class="o_thread_message_collapse collapse" t-attf-id="o_chatter_activity_info_#{activity.id}">
|
||||
<dl class="dl-horizontal">
|
||||
<dt>Activity type</dt>
|
||||
<dd class="mb8">
|
||||
<t t-esc="activity.activity_type_id[1]"/>
|
||||
</dd>
|
||||
<dt>Created on</dt>
|
||||
<dd class="mb8">
|
||||
<t t-esc="activity.create_date.format(datetimeFormat)"/>
|
||||
by
|
||||
<img t-attf-src="/web/image#{activity.create_uid[0] >= 0 ? ('/res.users/' + activity.create_uid[0] + '/avatar_128') : ''}"
|
||||
height="18" width="18"
|
||||
class="o_object_fit_cover rounded-circle mr4"
|
||||
t-att-title="activity.create_uid[1]"
|
||||
t-att-alt="activity.create_uid[1]"/>
|
||||
<b><t t-esc="activity.create_uid[1]"/></b>
|
||||
</dd>
|
||||
<dt>Assigned to</dt>
|
||||
<dd class="mb8">
|
||||
<img t-attf-src="/web/image#{activity.user_id[0] >= 0 ? ('/res.users/' + activity.user_id[0] + '/avatar_128') : ''}" height="18" width="18" class="o_object_fit_cover rounded-circle mr4" t-att-title="activity.user_id[1]" t-att-alt="activity.user_id[1]"/>
|
||||
<b><t t-esc="activity.user_id[1]"/></b>
|
||||
<em>, due on </em><span t-attf-class="o_activity_color_#{activity.state}"><t t-esc="activity.date_deadline.format(dateFormat)"/></span>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
</div>
|
||||
<div t-if="activity.note" t-attf-class="o_thread_message_#{activity.activity_decoration ? activity.activity_decoration : 'note'} #{activity.activity_decoration ? 'alert alert-' + activity.activity_decoration : ''}">
|
||||
<t t-raw="activity.note"/>
|
||||
</div>
|
||||
<t t-if="activity.mail_template_ids && activity.mail_template_ids.length > 0">
|
||||
<div class="mt16" t-att-data-activity-id="activity.id" t-att-data-previous-activity-type-id="activity.activity_type_id[0]">
|
||||
<t t-foreach="activity.mail_template_ids" t-as="mail_template">
|
||||
<div>
|
||||
<i class="fa fa-envelope-o" aria-label="Mail" title="Mail" role="img"></i>
|
||||
<span t-esc="mail_template.name"/>:
|
||||
<span class="o_activity_template_preview" t-att-data-template-id="mail_template.id">Preview</span>
|
||||
<span class="text-muted">or</span>
|
||||
<span class="o_activity_template_send" t-att-data-template-id="mail_template.id">Send Now</span>
|
||||
</div>
|
||||
</t>
|
||||
</div>
|
||||
</t>
|
||||
<div class="o_thread_message_tools btn-group">
|
||||
<t t-call="mail.activity_thread_message_tools"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</t>
|
||||
</div>
|
||||
</t>
|
||||
<t t-name="mail.activity_thread_message_tools">
|
||||
<div t-if="activity.can_write" class="o_thread_message_tools btn-group">
|
||||
<span t-if="activity.activity_category !== 'upload_file'" class="o_mark_as_done" data-toggle="popover" t-att-data-activity-id="activity.id" t-att-data-chaining-type-activity="activity.chaining_type" t-att-data-previous-activity-type-id="activity.activity_type_id[0]">
|
||||
<a role="button" href="#" class="btn btn-link btn-success text-muted o_activity_link mr8">
|
||||
<i class="fa fa-check"/> Mark Done </a>
|
||||
</span>
|
||||
<span t-if="activity.activity_category === 'upload_file'" class="o_mark_as_done_upload_file" t-att-data-activity-id="activity.id" t-att-data-chaining-type-activity="activity.chaining_type" t-att-data-previous-activity-type-id="activity.activity_type_id[0]" t-att-data-fileupload-id="activity.fileuploadID">
|
||||
<a role="button" href="#" class="btn btn-link btn-success text-muted o_activity_link mr8">
|
||||
<i class="fa fa-upload"/> Upload Document </a>
|
||||
</span>
|
||||
<span t-if="activity.activity_category === 'upload_file'" class="d-none">
|
||||
<t t-call="HiddenInputFile">
|
||||
<t t-set="fileupload_id" t-value="activity.fileuploadID"/>
|
||||
<t t-set="fileupload_action" t-translation="off">/web/binary/upload_attachment</t>
|
||||
<input type="hidden" name="model" t-att-value="activity.res_model"/>
|
||||
<input type="hidden" name="id" t-att-value="activity.res_id"/>
|
||||
</t>
|
||||
</span>
|
||||
<a role="button" href="#" class="btn btn-link btn-secondary text-muted o_edit_activity o_activity_link" t-att-data-activity-id="activity.id">
|
||||
<i class="fa fa-pencil"/> Edit
|
||||
</a>
|
||||
<a role="button" href="#" class="btn btn-link btn-danger text-muted o_unlink_activity o_activity_link" t-att-data-activity-id="activity.id">
|
||||
<i class="fa fa-times"/> Cancel
|
||||
</a>
|
||||
</div>
|
||||
</t>
|
||||
<t t-name="mail.activity_feedback_form">
|
||||
<div>
|
||||
<textarea class="form-control" rows="3" id="activity_feedback" placeholder="Write Feedback"/>
|
||||
|
||||
Reference in New Issue
Block a user