[FIX] web: search panel: keep good active values
In saas-13.4, if a searchpanel_default_XXXX value was found in the
context to be used as the default value of a searchpanel category
(select="one" field), then the value shown to be active for that
category would always be that value even if another value would have
been selected at some point. This was due to the fact that the
activeValueId was reset at each reload of the category to be that
default value.
In saas-13.5, the problem has been solved by 7ff2e5822f.
The present commit is simply the forward port of a test that covers the
situation described above.
closes odoo/odoo#56042
Task: 2259602
X-original-commit: bdf4fe44652668274030bb6fda25cb564f15c3a6
Signed-off-by: Mathieu Duckerts-Antoine <Polymorphe57@users.noreply.github.com>
This commit is contained in:
committed by
Mathieu Duckerts-Antoine
parent
452d7427ca
commit
c6b0876fa6
@@ -305,10 +305,10 @@ QUnit.module('Views', {
|
||||
kanban.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('specify active category value in context', async function (assert) {
|
||||
assert.expect(1);
|
||||
QUnit.test('specify active category value in context and manually change category', async function (assert) {
|
||||
assert.expect(5);
|
||||
|
||||
var kanban = await createView({
|
||||
const kanban = await createView({
|
||||
View: KanbanView,
|
||||
model: 'partner',
|
||||
data: this.data,
|
||||
@@ -333,7 +333,7 @@ QUnit.module('Views', {
|
||||
},
|
||||
mockRPC: function (route, args) {
|
||||
if (route === '/web/dataset/search_read') {
|
||||
assert.deepEqual(args.domain, [["state", "=", "ghi"]]);
|
||||
assert.step(JSON.stringify(args.domain));
|
||||
}
|
||||
return this._super.apply(this, arguments);
|
||||
},
|
||||
@@ -343,6 +343,26 @@ QUnit.module('Views', {
|
||||
},
|
||||
});
|
||||
|
||||
assert.deepEqual(
|
||||
[...kanban.el.querySelectorAll('.o_search_panel_category_value header.active label')].map(
|
||||
el => el.innerText
|
||||
),
|
||||
['All', 'GHI']
|
||||
);
|
||||
|
||||
// select 'ABC' in the category 'state'
|
||||
await testUtils.dom.click(kanban.el.querySelectorAll('.o_search_panel_category_value header')[4]);
|
||||
assert.deepEqual(
|
||||
[...kanban.el.querySelectorAll('.o_search_panel_category_value header.active label')].map(
|
||||
el => el.innerText
|
||||
),
|
||||
['All', 'ABC']
|
||||
);
|
||||
|
||||
assert.verifySteps([
|
||||
'[["state","=","ghi"]]',
|
||||
'[["state","=","abc"]]'
|
||||
]);
|
||||
kanban.destroy();
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user