[FIX] web: fix calendar mobile view creation record
issue: - calendar mobile view (month) > pressing on a day or timeframe to create a task doesn't work if the view does not have the "day" calendar scale set up Fix: - We are removing the condition preventing the renderer to use the createRecord callback when the view is Mobile and in monthly scale So now a record will be directly created when a user clicks on a timeframe in monthly view even if he's in mobile view Task-3677216 closes odoo/odoo#150624 X-original-commit: da23aa3d68e0f8b833d085c09bcf81d8aa2a4285 Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
This commit is contained in:
committed by
Xavier Bol (xbo)
parent
191f243871
commit
b45d2c96fe
@@ -194,13 +194,6 @@ export class CalendarCommonRenderer extends Component {
|
||||
this.highlightEvent(info.event, "o_cw_custom_highlight");
|
||||
}
|
||||
onDateClick(info) {
|
||||
if (this.env.isSmall && this.props.model.scale === "month") {
|
||||
this.props.model.load({
|
||||
date: luxon.DateTime.fromISO(info.dateStr),
|
||||
scale: "day",
|
||||
});
|
||||
return;
|
||||
}
|
||||
this.props.createRecord(this.fcEventToRecord(info));
|
||||
}
|
||||
onDayRender(info) {
|
||||
|
||||
@@ -344,7 +344,7 @@ QUnit.module("Views", ({ beforeEach }) => {
|
||||
assert.verifySteps(["select"]);
|
||||
});
|
||||
|
||||
QUnit.test("calendar (month/year): tap on date switch to day scale", async function (assert) {
|
||||
QUnit.test("calendar (year): tap on date switch to day scale", async function (assert) {
|
||||
await makeView({
|
||||
type: "calendar",
|
||||
resModel: "event",
|
||||
@@ -360,6 +360,10 @@ QUnit.module("Views", ({ beforeEach }) => {
|
||||
await tap(target, ".fc-day-top[data-date='2016-02-05']");
|
||||
await nextTick(); // switch renderer
|
||||
await nextTick(); // await breadcrumb update
|
||||
assert.strictEqual(
|
||||
document.querySelector(".o_calendar_container .o_calendar_header h5").textContent,
|
||||
"5 February 2016"
|
||||
);
|
||||
|
||||
// Should display day view
|
||||
assert.containsNone(target, ".fc-dayGridYear-view");
|
||||
@@ -382,10 +386,10 @@ QUnit.module("Views", ({ beforeEach }) => {
|
||||
await nextTick(); // await breadcrumb update
|
||||
assert.strictEqual(
|
||||
document.querySelector(".o_calendar_container .o_calendar_header h5").textContent,
|
||||
"10 February 2016"
|
||||
"February 2016"
|
||||
);
|
||||
assert.containsNone(target, ".fc-dayGridMonth-view");
|
||||
assert.containsOnce(target, ".fc-timeGridDay-view");
|
||||
assert.equal(target.querySelector(".fc-day-header[data-date]").dataset.date, "2016-02-10");
|
||||
|
||||
// should open a Quick create modal view in mobile on short tap on date in monthly view
|
||||
assert.containsOnce(target, ".modal");
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user