diff --git a/addons/board/static/src/js/dashboard.js b/addons/board/static/src/js/dashboard.js index 3c40524e12c..72a2a0383f6 100644 --- a/addons/board/static/src/js/dashboard.js +++ b/addons/board/static/src/js/dashboard.js @@ -232,6 +232,7 @@ FormRenderer.include({ var view = new View(viewInfo, { action: action, context: context, + domain: params.domain, groupBy: context.group_by, modelName: action.res_model, hasSelectors: false, diff --git a/addons/board/static/tests/dashboard_tests.js b/addons/board/static/tests/dashboard_tests.js index 1b55551fe2b..27d685ff46e 100644 --- a/addons/board/static/tests/dashboard_tests.js +++ b/addons/board/static/tests/dashboard_tests.js @@ -99,7 +99,7 @@ QUnit.test('display the no content helper', function (assert) { }); QUnit.test('basic functionality, with one sub action', function (assert) { - assert.expect(24); + assert.expect(25); var form = createView({ View: FormView, @@ -108,11 +108,11 @@ QUnit.test('basic functionality, with one sub action', function (assert) { arch: '
', - mockRPC: function (route) { + mockRPC: function (route, args) { if (route === '/web/action/load') { assert.step('load action'); return $.when({ @@ -120,6 +120,9 @@ QUnit.test('basic functionality, with one sub action', function (assert) { views: [[4, 'list']], }); } + if (route === '/web/dataset/search_read') { + assert.deepEqual(args.domain, [['foo', '!=', 'False']], "the domain should be passed"); + } if (route === '/board/static/src/img/layout_1-1-1.png') { return $.when(); } diff --git a/addons/web/static/src/js/views/basic/basic_controller.js b/addons/web/static/src/js/views/basic/basic_controller.js index 54c8ccfbf51..39e596db5b8 100644 --- a/addons/web/static/src/js/views/basic/basic_controller.js +++ b/addons/web/static/src/js/views/basic/basic_controller.js @@ -238,7 +238,7 @@ var BasicController = AbstractController.extend(FieldManagerMixin, { var recordID = record.data.id; this.trigger_up('execute_action', { action_data: _.extend({}, attrs, { - context: record.getContext({additionalContext: attrs.context}), + context: record.getContext({additionalContext: attrs.context || {}}), }), model: record.model, res_ids: [recordID], diff --git a/addons/web/static/tests/views/form_tests.js b/addons/web/static/tests/views/form_tests.js index 2198177e43e..7eed1a2d100 100644 --- a/addons/web/static/tests/views/form_tests.js +++ b/addons/web/static/tests/views/form_tests.js @@ -3608,6 +3608,40 @@ QUnit.module('Views', { form.destroy(); }); + QUnit.test('clicking on a stat button with no context', function (assert) { + assert.expect(1); + + var form = createView({ + View: FormView, + model: 'partner', + data: this.data, + arch: + '', + res_id: 2, + viewOptions: { + context: {some_context: true}, + }, + intercepts: { + execute_action: function (e) { + assert.deepEqual(e.data.action_data.context, {}, + "button context should have been evaluated and given to the action, without previous context"); + }, + }, + }); + + form.$('.oe_stat_button').click(); + + form.destroy(); + }); + QUnit.test('diplay a stat button outside a buttonbox', function (assert) { assert.expect(3); diff --git a/odoo/addons/test_main_flows/static/src/js/tour.js b/odoo/addons/test_main_flows/static/src/js/tour.js index 4ad087e9a45..96ae44af4b5 100644 --- a/odoo/addons/test_main_flows/static/src/js/tour.js +++ b/odoo/addons/test_main_flows/static/src/js/tour.js @@ -282,7 +282,7 @@ tour.register('main_flow_tour', { position: "bottom", }, { // Create a quotation - trigger: ".o_statusbar_buttons > button:contains('New Quotation')", + trigger: ".o_statusbar_buttons > button:enabled:contains('New Quotation')", content: _t('Create a quotation
'), position: "right" }, { @@ -329,11 +329,11 @@ tour.register('main_flow_tour', { } }, }, { - trigger: ".o_statusbar_buttons > button.o_sale_print", + trigger: ".o_statusbar_buttons > button.o_sale_print:enabled", content: _t("Print this quotation.
"), position: "bottom" }, { - trigger: ".o_statusbar_buttons > button:contains('Send by Email')", + trigger: ".o_statusbar_buttons > button:enabled:contains('Send by Email')", extra_trigger: ".o_statusbar_status .btn-primary:contains('Quotation Sent')", content: _t("Try to send it to email"), position: "bottom", @@ -351,7 +351,7 @@ tour.register('main_flow_tour', { content: _t("Try to send it to email"), position: "bottom", }, { - trigger: ".o_statusbar_buttons > button:contains('Confirm Sale')", + trigger: ".o_statusbar_buttons > button:enabled:contains('Confirm Sale')", content: _t("Confirm this quotation
"), position: "bottom" }, { @@ -434,15 +434,15 @@ tour.register('main_flow_tour', { content: _t('Select the generated request for quotation'), position: 'bottom', }, { - trigger: ".o_statusbar_buttons > button:contains('Confirm Order')", + trigger: ".o_statusbar_buttons > button:enabled:contains('Confirm Order')", content: _t("Confirm quotation"), position: "bottom", }, { - trigger: ".o_statusbar_buttons > button:contains('Receive Products')", + trigger: ".o_statusbar_buttons > button:enabled:contains('Receive Products')", content: _t("Receive Product"), position: "bottom", }, { - trigger: ".o_statusbar_buttons > button:contains('Validate')", + trigger: ".o_statusbar_buttons > button:enabled:contains('Validate')", content: _t("Validate"), position: "bottom", }, { @@ -463,11 +463,11 @@ tour.register('main_flow_tour', { content: _t("Let's create a new vendor bill"), position: "right", }, { - trigger: ".o_statusbar_buttons > button:contains('Validate')", + trigger: ".o_statusbar_buttons > button:enabled:contains('Validate')", content: _t("Try to send it to email"), position: "bottom", }, { - trigger: ".o_statusbar_buttons > button:contains('Register Payment')", + trigger: ".o_statusbar_buttons > button:enabled:contains('Register Payment')", content: _t("Register Payment"), position: "bottom", }, { @@ -495,11 +495,11 @@ tour.register('main_flow_tour', { content: _t('Select the generated manufacturing order'), position: 'bottom', }, { - trigger: ".o_statusbar_buttons > button:contains('Check availability')", + trigger: ".o_statusbar_buttons > button:enabled:contains('Check availability')", content: _t("Check availability"), position: "bottom", }, { - trigger: ".o_statusbar_buttons > button.oe_highlight:contains('Produce')", + trigger: ".o_statusbar_buttons > button.oe_highlight:enabled:contains('Produce')", content: _t("Produce"), position: "bottom", }, { @@ -507,7 +507,7 @@ tour.register('main_flow_tour', { content: _t('Record Production'), position: 'bottom', }, { - trigger: ".o_statusbar_buttons > button:contains('Mark as Done')", + trigger: ".o_statusbar_buttons > button:enabled:contains('Mark as Done')", content: _t("Mark as Done"), position: "bottom", }, { @@ -578,7 +578,7 @@ tour.register('main_flow_tour', { content: _t('Back to the sale order'), position: 'bottom', }, { - trigger: ".o_statusbar_buttons > button:contains('Create Invoice')", + trigger: ".o_statusbar_buttons > button:enabled:contains('Create Invoice')", content: _t("Validate"), position: "bottom", }, { @@ -586,11 +586,11 @@ tour.register('main_flow_tour', { content: _t("Create and View Invoices"), position: "bottom", }, { - trigger: ".o_statusbar_buttons > button:contains('Validate')", + trigger: ".o_statusbar_buttons > button:enabled:contains('Validate')", content: _t("Validate"), position: "bottom", }, { - trigger: ".o_statusbar_buttons > button:contains('Register Payment')", + trigger: ".o_statusbar_buttons > button:enabled:contains('Register Payment')", content: _t("Register Payment"), position: "bottom", }, { @@ -665,7 +665,7 @@ tour.register('main_flow_tour', { position: 'bottom', }, { edition: "enterprise", - trigger: ".o_statusbar_buttons > button:contains('Reconcile')", + trigger: ".o_statusbar_buttons > button:enabled:contains('Reconcile')", content: _t('Reconcile
'), position: "bottom", }, {