Files
odoo_source/addons/calendar/static/tests/activity_tests.js
T
Dharmraj Jhala d8d30829c6 [FIX] calendar: open calendar view from 'Reschedule' activity button
With recent commit[1], we now use the wowlEnv instead of the legacy one,
and use the service provided by env to call the rpc.

This was adapted in the activity model, but not on the patched method
under calendar.

This commit fixes the issues to adpat the change, and so the 'Reschedule'
button for the meeting activity now opens the calendar view as expected.

Apart from that, this commit also tries to align this button with other
activity buttons, for better UI.

commit[1] - https://github.com/odoo/odoo/commit/3573a7fef497d

taskID-2899402

closes odoo/odoo#95747

X-original-commit: b7efe2a80f9da175114cf1138565580981690001
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2022-07-12 18:31:13 +02:00

50 lines
1.4 KiB
JavaScript

/** @odoo-module **/
import { start, startServer } from '@mail/../tests/helpers/test_utils';
QUnit.module('calendar', () => {
QUnit.module('components', () => {
QUnit.module('activity_tests.js');
QUnit.test('activity click on Reschedule', async function (assert) {
assert.expect(1);
const pyEnv = await startServer();
const resPartnerId = pyEnv['res.partner'].create({});
const meetingActivityTypeId = pyEnv['mail.activity.type'].create({ icon: 'fa-calendar', name: "Meeting" });
const calendarAttendeeId = pyEnv['calendar.attendee'].create({ partner_id: resPartnerId });
const calendaMeetingId = pyEnv['calendar.event'].create({
res_model: "calendar.event",
name: "meeting1",
start: "2022-07-06 06:30:00",
attendee_ids: [calendarAttendeeId],
});
pyEnv['mail.activity'].create({
name: "Small Meeting",
activity_type_id: meetingActivityTypeId,
can_write: true,
res_id: resPartnerId,
res_model: 'res.partner',
calendar_event_id: calendaMeetingId,
});
const { click, openFormView } = await start();
await openFormView(
{
res_model: 'res.partner',
res_id: resPartnerId,
},
);
await click('.o_Activity_editButton');
assert.containsOnce(
document.body,
'.o_calendar_view',
"should have opened calendar view"
);
});
});
});