[FIX] web: Display event name on calendar popup instead of undefined

Purpose
=======

When you edit a Time Off Request from the dashboard. The title in the header
is undefined

https://drive.google.com/open?id=1vBg9AlVCN7rc5D6DUel8hx2uY-oOfwRs
This commit is contained in:
RomainLibert
2019-09-11 09:27:41 +00:00
committed by Yannick Tivisse
parent ca06a0e6b3
commit 653cccfd60
3 changed files with 11 additions and 4 deletions
@@ -123,7 +123,10 @@ var CalendarPopover = Widget.extend(StandaloneFieldManagerMixin, {
*/
_onClickPopoverEdit: function (ev) {
ev.preventDefault();
this.trigger_up('edit_event', {id: this.event.id});
this.trigger_up('edit_event', {
id: this.event.id,
title: this.event.record.display_name,
});
},
/**
* @private
@@ -699,7 +699,7 @@ return AbstractRenderer.extend({
} else {
context.eventDate.date = isSameDayEvent ? start.clone().format('dddd, LL') : start.clone().format('LL') + ' - ' + end.clone().format('LL');
}
if (eventData.record.allday && isSameDayEvent) {
context.eventDate.duration = _t("All day");
} else if (eventData.record.allday && !isSameDayEvent) {
@@ -772,7 +772,10 @@ return AbstractRenderer.extend({
*/
_onEditEvent: function (event) {
this._unselectEvent();
this.trigger_up('openEvent', {_id: event.data.id});
this.trigger_up('openEvent', {
_id: event.data.id,
title: event.data.title,
});
},
/**
* @private
@@ -1902,7 +1902,7 @@ QUnit.module('Views', {
});
QUnit.test('Update event with filters', async function (assert) {
assert.expect(5);
assert.expect(6);
var records = this.data.user.records;
records.push({
@@ -1958,6 +1958,7 @@ QUnit.module('Views', {
await testUtils.dom.click(calendar.$('.fc-event:contains(event 2) .fc-content'));
assert.ok(calendar.$('.o_cw_popover').length, "should open a popover clicking on event");
await testUtils.dom.click(calendar.$('.o_cw_popover .o_cw_popover_edit'));
assert.strictEqual($('.modal .modal-title').text(), 'Open: event 2', "dialog should have a valid title");
await testUtils.dom.click($('.modal .o_field_widget[name="user_id"] input'));
await testUtils.dom.click($('.ui-menu-item a:contains(user 5)').trigger('mouseenter'));
await testUtils.dom.click($('.modal button.btn:contains(Save)'));