summaryrefslogtreecommitdiff
path: root/addons/mail/static/tests/activity_tests.js
diff options
context:
space:
mode:
authorPriyanka Kakadiya <pka@odoo.com>2019-09-17 06:56:39 +0000
committerAlexandre Kühn <aku@odoo.com>2019-09-27 14:45:51 +0000
commit9b57bfb6a2dcceaa224a64ff8dcfbe7bc6993b1e (patch)
tree9afdd9146a99b459019cf5b45671ae9a21c1ad5c /addons/mail/static/tests/activity_tests.js
parent69bf106a47592d7f868a54b18f8f80ee0491a457 (diff)
[FIX] web, *: button special not working to close dialog
*: event_sale mail sale_product_connfigurator stock Before this commit: if we open dialog from acitivity view and try to discard it (i.e. close it), it throws traceback. Issue arises from following commits: https://github.com/odoo/odoo/commit/d3d576cf8ec9e5b5f6ae5f9d8845cf384435f12d https://github.com/odoo/odoo/commit/3210f108272be89f1a7b01f4e1816b7f04ae0a3b Previously, special attribute was passed directly, but now `on_close` gets action info as an object. After this commit, it passes special key as an object for `on_close`, also changed special action based logic in other modules. Task-Id 2072181 closes odoo/odoo#37078 Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com> Co-authored-by: Mohammed Shekha <msh@odoo.com>
Diffstat (limited to 'addons/mail/static/tests/activity_tests.js')
-rw-r--r--addons/mail/static/tests/activity_tests.js59
1 files changed, 59 insertions, 0 deletions
diff --git a/addons/mail/static/tests/activity_tests.js b/addons/mail/static/tests/activity_tests.js
index 8134e6699f5..6c3c297ba5a 100644
--- a/addons/mail/static/tests/activity_tests.js
+++ b/addons/mail/static/tests/activity_tests.js
@@ -457,5 +457,64 @@ QUnit.test('activity view: search more to schedule an activity for a record of a
activity.destroy();
});
+QUnit.test('Activity view: discard an activity creation dialog', async function (assert) {
+ assert.expect(2);
+
+ var actionManager = await createActionManager({
+ actions: [{
+ id: 1,
+ name: 'Task Action',
+ res_model: 'task',
+ type: 'ir.actions.act_window',
+ views: [[false, 'activity']],
+ }],
+ archs: {
+ 'task,false,activity': `
+ <activity string="Task">
+ <templates>
+ <div t-name="activity-box">
+ <field name="foo"/>
+ </div>
+ </templates>
+ </activity>`,
+ 'task,false,search': '<search></search>',
+ 'mail.activity,false,form': `
+ <form>
+ <field name="display_name"/>
+ <footer>
+ <button string="Discard" class="btn-secondary" special="cancel"/>
+ </footer>
+ </form>`
+ },
+ data: this.data,
+ intercepts: {
+ do_action(ev) {
+ actionManager.doAction(ev.data.action, ev.data.options);
+ }
+ },
+ async mockRPC(route, args) {
+ if (args.method === 'check_access_rights') {
+ return true;
+ }
+ return this._super(...arguments);
+ },
+ });
+ await actionManager.doAction(1);
+
+ await testUtils.dom.click(actionManager.$('.o_activity_view .o_data_row .o_activity_empty_cell')[0]);
+ assert.containsOnce(
+ $,
+ '.modal.o_technical_modal.show',
+ "Activity Modal should be opened");
+
+ await testUtils.dom.click($('.modal.o_technical_modal.show button[special="cancel"]'));
+ assert.containsNone(
+ $,
+ '.modal.o_technical_modal.show',
+ "Activity Modal should be closed");
+
+ actionManager.destroy();
+});
+
});
});