[FIX] web: restore disableQuickCreate on calendar event

Since commit odoo/odoo@ebce7719b6
the disableQuickCreate parameter was lost during the process.

Note: there is no steps to reproduce as this feature was never used.

Related Task ID: 1891957
This commit is contained in:
Romeo Fragomeli
2021-01-28 13:55:50 +00:00
parent 7ffa4ddb69
commit 3552d46037
2 changed files with 51 additions and 0 deletions
@@ -338,6 +338,7 @@ return AbstractRenderer.extend({
r_end: fc4Event.extendedProps.r_end && moment(fc4Event.extendedProps.r_end).utcOffset(0, true),
record: fc4Event.extendedProps.record,
attendees: fc4Event.extendedProps.attendees,
disableQuickCreate: fc4Event.extendedProps.disableQuickCreate,
});
}
}
@@ -3938,6 +3938,56 @@ QUnit.module('Views', {
calendar.destroy();
});
QUnit.test('calendar: disableQuickCreate in data event', async function (assert) {
assert.expect(3);
testUtils.mock.patch(CalendarRenderer, {
_preOpenCreate: function (data) {
data = Object.assign({}, data, {
extendedProps: {disableQuickCreate: true},
});
return this._super.call(this, data);
},
});
let calendar = await testUtils.createCalendarView({
View: CalendarView,
model: 'event',
data: this.data,
arch: `<calendar mode="day" date_start="start" date_stop="stop"></calendar>`,
viewOptions: {
initialDate: initialDate,
},
intercepts: {
do_action(ev) {
assert.step('do_action');
assert.deepEqual(ev.data.action.context, {
default_start: "2016-12-12 06:30:00",
default_stop: "2016-12-12 11:00:00",
}, "should send the correct data to create events");
},
},
}, {positionalClicks: true});
// Create event
var $initCell = calendar.$('.fc-time-grid .fc-minor[data-time="06:30:00"] .fc-widget-content:last-child');
var $endCell = calendar.$('.fc-time-grid .fc-minor[data-time="10:30:00"] .fc-widget-content:last-child');
var left = $initCell.offset().left;
var top = $initCell.offset().top;
testUtils.dom.triggerPositionalMouseEvent(left, top, "mousedown");
top = $endCell.offset().top;
testUtils.dom.triggerPositionalMouseEvent(left, top, "mousemove");
testUtils.dom.triggerPositionalMouseEvent(left, top, "mouseup");
await testUtils.nextTick();
assert.verifySteps(['do_action']);
calendar.destroy();
testUtils.mock.unpatch(CalendarRenderer);
});
});
});