summaryrefslogtreecommitdiff
path: root/addons/web/static/tests/chrome
diff options
context:
space:
mode:
authorLucas Lefèvre <lul@odoo.com>2020-04-01 07:08:41 +0000
committerAaron Bohy <aab@odoo.com>2020-04-02 21:06:25 +0000
commit124829263021c64f6a003805d9311774372ed23b (patch)
treef6fd8a1a04131c42e6bde9bc96449f0fa383b6da /addons/web/static/tests/chrome
parenta768937a398cb6075dc9b4a36b8f732270b8e0ed (diff)
[FIX] web,*: Remove undefined domain in action menu context
*google_drive Go to a user form view and click on "Change Password" in the action menus. => traceback `Cannot read property 'constructor' of undefined` This error is raised because `active_domain: undefined` is in the context and py_eval can't handle an undefined value. closes odoo/odoo#48915 X-original-commit: 69694c627be42e3d068e48be14026493628a3a8d Signed-off-by: Aaron Bohy (aab) <aab@odoo.com> Signed-off-by: lul-odoo <LucasLefevre@users.noreply.github.com> Co-authored-by: aab-odoo <aab@odoo.com>
Diffstat (limited to 'addons/web/static/tests/chrome')
-rw-r--r--addons/web/static/tests/chrome/action_manager_tests.js43
1 files changed, 43 insertions, 0 deletions
diff --git a/addons/web/static/tests/chrome/action_manager_tests.js b/addons/web/static/tests/chrome/action_manager_tests.js
index 3fd3598000a..5af731abf81 100644
--- a/addons/web/static/tests/chrome/action_manager_tests.js
+++ b/addons/web/static/tests/chrome/action_manager_tests.js
@@ -3702,6 +3702,49 @@ QUnit.module('ActionManager', {
actionManager.destroy();
});
+ QUnit.test('execute a contextual action from a form view', async function (assert) {
+ assert.expect(4);
+
+ const contextualAction = this.actions.find(action => action.id === 8);
+ contextualAction.context = "{}"; // need a context to evaluate
+
+ const actionManager = await createActionManager({
+ actions: this.actions,
+ archs: this.archs,
+ data: this.data,
+ mockRPC: async function (route, args) {
+ const res = await this._super(...arguments);
+ if (args.method === 'load_views' && args.model === 'partner') {
+ assert.strictEqual(args.kwargs.options.toolbar, true,
+ "should ask for toolbar information");
+ res.form.toolbar = {
+ action: [contextualAction],
+ print: [],
+ };
+ }
+ return res;
+ },
+ intercepts: {
+ do_action: function (ev) {
+ actionManager.doAction(ev.data.action, {});
+ },
+ },
+ });
+
+ // execute an action and open a record
+ await actionManager.doAction(3);
+ assert.containsOnce(actionManager, '.o_list_view');
+ await testUtils.dom.click(actionManager.$('.o_data_row:first'));
+ assert.containsOnce(actionManager, '.o_form_view');
+
+ // execute the custom action from the action menu
+ await cpHelpers.toggleActionMenu(actionManager);
+ await cpHelpers.toggleMenuItem(actionManager, "Favorite Ponies");
+ assert.containsOnce(actionManager, '.o_list_view');
+
+ actionManager.destroy();
+ });
+
QUnit.module('Actions in target="new"');
QUnit.test('can execute act_window actions in target="new"', async function (assert) {