Skip to content

Commit

Permalink
[IMP] lunch,web: don't disable SearchPanel on mobile
Browse files Browse the repository at this point in the history
SearchPanel widget in kanban views has been introduced in commit
odoo@25c9355.
But this feature was disabled for mobile.

This commit removes unneeded differentiation between desktop and mobile
for the SearchPanel.

It also adapt related tests to reflect this change.

Task ID: 1917277
  • Loading branch information
pparidans committed May 23, 2019
1 parent 627fd77 commit 4d1cce9
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 37 deletions.
14 changes: 9 additions & 5 deletions addons/lunch/static/tests/lunch_kanban_mobile_tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,14 @@ QUnit.module('LunchKanbanView Mobile', {
return Promise.resolve();
},
},
'lunch.product.category': {
fields: {},
records: [],
},
'lunch.supplier': {
fields: {},
records: [],
},
'ir.model.data': {
fields: {},
xmlid_to_res_id() {
Expand All @@ -51,7 +59,7 @@ QUnit.module('LunchKanbanView Mobile', {
},
}, function () {
QUnit.test('basic rendering', async function (assert) {
assert.expect(9);
assert.expect(7);

const kanban = await createLunchKanbanView({
View: LunchKanbanView,
Expand All @@ -76,10 +84,6 @@ QUnit.module('LunchKanbanView Mobile', {
"should have 1 records in the renderer");

// check view layout
assert.containsOnce(kanban, '.o_content > div',
"should have 1 column");
assert.containsNone(kanban, '.o_content > div.o_search_panel',
"shouldn't have a 'lunch filters' column");
assert.containsOnce(kanban, '.o_content > .o_lunch_kanban',
"should have a 'kanban lunch wrapper' column");
assert.containsOnce(kanban, '.o_lunch_kanban > .o_kanban_view',
Expand Down
4 changes: 1 addition & 3 deletions addons/web/static/src/js/views/kanban/kanban_view.js
Original file line number Diff line number Diff line change
Expand Up @@ -188,9 +188,7 @@ var KanbanView = BasicView.extend({
*/
_processNode: function (node, fv) {
if (node.tag === 'searchpanel') {
if (!config.device.isMobile) {
this._processSearchPanelNode(node, fv);
}
this._processSearchPanelNode(node, fv);
return false;
}
return this._super.apply(this, arguments);
Expand Down
29 changes: 0 additions & 29 deletions addons/web/static/tests/views/kanban_mobile_tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -194,34 +194,5 @@ QUnit.module('Views', {

kanban.destroy();
});

QUnit.test('kanban with searchpanel: there should be no searchpanel in mobile', async function (assert) {
assert.expect(3);

var kanban = await createView({
View: KanbanView,
model: 'partner',
data: this.data,
arch: '<kanban>' +
'<templates><t t-name="kanban-box">' +
'<div>' +
'<field name="foo"/>' +
'</div>' +
'</t></templates>' +
'<searchpanel>' +
'<field name="product_id"/>' +
'</searchpanel>' +
'</kanban>',
mockRPC: function (route, args) {
assert.step(args.method || route);
return this._super.apply(this, arguments);
},
});

assert.containsNone(kanban, '.o_search_panel');
assert.verifySteps(['/web/dataset/search_read']);

kanban.destroy();
});
});
});

0 comments on commit 4d1cce9

Please sign in to comment.