[MERGE] forward port branch saas-16 up to 3becbd764d

This commit is contained in:
Christophe Simonis
2017-07-31 19:07:04 +02:00
5 changed files with 58 additions and 20 deletions
+1
View File
@@ -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,
+6 -3
View File
@@ -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: '<form string="My Dashboard">' +
'<board style="2-1">' +
'<column>' +
'<action context="{}" view_mode="list" string="ABC" name="51" domain="[]"></action>' +
'<action context="{}" view_mode="list" string="ABC" name="51" domain="[[\'foo\', \'!=\', \'False\']]"></action>' +
'</column>' +
'</board>' +
'</form>',
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();
}
@@ -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],
@@ -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:
'<form string="Partners">' +
'<sheet>' +
'<div class="oe_button_box" name="button_box">' +
'<button class="oe_stat_button" type="action" name="1">' +
'<field name="qux" widget="statinfo"/>' +
'</button>' +
'</div>' +
'</sheet>' +
'</form>',
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);
@@ -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('<p><b>Create a quotation</p>'),
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("<p><b>Print this quotation.</b></p>"),
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("<p>Confirm this quotation</p>"),
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('<p><b>Reconcile</p>'),
position: "bottom",
}, {