[IMP] mail: few improvements on activity widget
PURPOSE Display the activity type through the icon of the widget and change the place to display to whom the activity is assigned (if it is not assigned to the current user). SPECIFICATION Display the deadline with a prefix as responsible if the activity assigned to another user than the current one (uid). Add a new 'activity_type_icon' field to the mail mixin to get the 'icon' of the type (fa-phone, fa-users, etc...) and for the list_activity widget, display it as an icon instead of the default 'fa-clock-o' icon. LINKS PR https://github.com/odoo/odoo/pull/52252 Task-2267579 closes odoo/odoo#52252 Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
This commit is contained in:
@@ -666,6 +666,7 @@ class MailActivityMixin(models.AbstractModel):
|
||||
related='activity_ids.activity_type_id', readonly=False,
|
||||
search='_search_activity_type_id',
|
||||
groups="base.group_user")
|
||||
activity_type_icon = fields.Char('Activity Type Icon', related='activity_ids.icon')
|
||||
activity_date_deadline = fields.Date(
|
||||
'Next Activity Deadline',
|
||||
compute='_compute_activity_date_deadline', search='_search_activity_date_deadline',
|
||||
|
||||
@@ -768,6 +768,7 @@ const ListActivity = KanbanActivity.extend({
|
||||
fieldDependencies: _.extend({}, KanbanActivity.prototype.fieldDependencies, {
|
||||
activity_summary: {type: 'char'},
|
||||
activity_type_id: {type: 'many2one', relation: 'mail.activity.type'},
|
||||
activity_type_icon: {type: 'char'},
|
||||
}),
|
||||
label: _lt('Next Activity'),
|
||||
|
||||
@@ -795,6 +796,9 @@ const ListActivity = KanbanActivity.extend({
|
||||
}
|
||||
this.$('.o_activity_summary').text(text);
|
||||
}
|
||||
if (this.recordData.activity_type_icon) {
|
||||
this.el.querySelector('.o_activity_btn > span').classList.replace('fa-clock-o', this.recordData.activity_type_icon);
|
||||
}
|
||||
},
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
@@ -68,6 +68,7 @@
|
||||
</div>
|
||||
<div class="o_activity_title_entry mt-1" t-if="log.state != 'today'">
|
||||
<span class="fa fa-clock-o fa-fw mr-2 text-center text-muted" role="img" aria-label="Deadline" title="Deadline"/>
|
||||
<small t-if="log.user_id[0] !== session.uid and log.mail_template_ids" class="mr-1"><t t-esc="log.user_id[1]"/> -</small>
|
||||
<small t-att-title="log.date_deadline"><t t-esc="log.label_delay" /></small>
|
||||
</div>
|
||||
<t t-if="log.mail_template_ids">
|
||||
@@ -81,10 +82,6 @@
|
||||
</small>
|
||||
</div>
|
||||
</t>
|
||||
<div t-if="log.user_id[0] != session.uid and log.mail_template_ids" class="o_activity_title_entry">
|
||||
<span class="fa fa-user fa-fw mr-2 text-center text-muted" role="img" aria-label="User" title="User"/>
|
||||
<span><t t-esc="log.user_id[1]" /></span>
|
||||
</div>
|
||||
</div>
|
||||
<div t-if="log.can_write" class="flex-grow-1 text-right">
|
||||
<t t-if="log.activity_category === 'upload_file'">
|
||||
|
||||
@@ -923,7 +923,7 @@ QUnit.test('list activity widget with no activity', async function (assert) {
|
||||
session: {uid: 2},
|
||||
});
|
||||
|
||||
assert.containsOnce(list, '.o_mail_activity .o_activity_color_default');
|
||||
assert.containsOnce(list, '.o_mail_activity .o_activity_color_default.fa-clock-o');
|
||||
assert.strictEqual(list.$('.o_activity_summary').text(), '');
|
||||
|
||||
assert.verifySteps(['/web/dataset/search_read']);
|
||||
@@ -938,6 +938,7 @@ QUnit.test('list activity widget with activities', async function (assert) {
|
||||
this.data.partner.records[0].activity_state = 'today';
|
||||
this.data.partner.records[0].activity_summary = 'Call with Al';
|
||||
this.data.partner.records[0].activity_type_id = 3;
|
||||
this.data.partner.records[0].activity_type_icon = 'fa-phone';
|
||||
|
||||
this.data.partner.records.push({
|
||||
id: 44,
|
||||
@@ -959,11 +960,11 @@ QUnit.test('list activity widget with activities', async function (assert) {
|
||||
});
|
||||
|
||||
const $firstRow = list.$('.o_data_row:first');
|
||||
assert.containsOnce($firstRow, '.o_mail_activity .o_activity_color_today');
|
||||
assert.containsOnce($firstRow, '.o_mail_activity .o_activity_color_today.fa-phone');
|
||||
assert.strictEqual($firstRow.find('.o_activity_summary').text(), 'Call with Al');
|
||||
|
||||
const $secondRow = list.$('.o_data_row:nth(1)');
|
||||
assert.containsOnce($secondRow, '.o_mail_activity .o_activity_color_planned');
|
||||
assert.containsOnce($secondRow, '.o_mail_activity .o_activity_color_planned.fa-clock-o');
|
||||
assert.strictEqual($secondRow.find('.o_activity_summary').text(), 'Type 2');
|
||||
|
||||
assert.verifySteps(['/web/dataset/search_read']);
|
||||
|
||||
Reference in New Issue
Block a user