[FIX] web: keep filter when leaving a kanban view and coming back
- Open a kanban view; - Select a progress bar filter; - Open a record; - Came back to kanban using the breadcrumb. Before this commit, the progress bar is selected, but the records aren't filtered. Now, the kanban is exactly the same as it was when we click on the record, the progress bar is selected and the records filtered. closes odoo/odoo#110224 X-original-commit: ca864d7e6d510ef6410898099364d854a15150d7 Signed-off-by: Aaron Bohy (aab) <aab@odoo.com> Signed-off-by: Jorge Pinna Puissant (jpp) <jpp@odoo.com> Co-authored-by: Aaron Bohy <aab@odoo.com>
This commit is contained in:
co-authored by
Aaron Bohy
parent
7f3a4fbb2d
commit
f56a2b4129
@@ -69,6 +69,7 @@ class KanbanGroup extends Group {
|
||||
/** @type {ProgressBar[]} */
|
||||
this.progressBars = this._generateProgressBars();
|
||||
this.progressValue = markRaw(state.progressValue || { active: null });
|
||||
this.list.domain = this.getProgressBarDomain();
|
||||
this.tooltip = [];
|
||||
|
||||
this.model.transaction.register({
|
||||
|
||||
@@ -10668,6 +10668,69 @@ QUnit.module("Views", (hooks) => {
|
||||
assert.containsN(target, ".o_kanban_record", 2);
|
||||
});
|
||||
|
||||
QUnit.test("filter groups are kept when leaving and coming back", async (assert) => {
|
||||
serverData.models.partner.records[1].state = "abc";
|
||||
serverData.views = {
|
||||
"partner,false,kanban": `
|
||||
<kanban>
|
||||
<progressbar field="state" colors='{"abc": "success", "def": "warning", "ghi": "danger"}' />
|
||||
<templates>
|
||||
<t t-name="kanban-box">
|
||||
<div class="oe_kanban_global_click">
|
||||
<field name="id" />
|
||||
</div>
|
||||
</t>
|
||||
</templates>
|
||||
</kanban>`,
|
||||
"partner,false,search": "<search/>",
|
||||
"partner,false,form": `
|
||||
<form>
|
||||
<field name="state" widget="radio"/>
|
||||
</form>`,
|
||||
};
|
||||
const webClient = await createWebClient({ serverData });
|
||||
await doAction(webClient, {
|
||||
name: "Partners",
|
||||
res_model: "partner",
|
||||
type: "ir.actions.act_window",
|
||||
views: [
|
||||
[false, "kanban"],
|
||||
[false, "form"],
|
||||
],
|
||||
context: {
|
||||
group_by: ["bar"],
|
||||
},
|
||||
});
|
||||
|
||||
// Filter on state "abc" => matches 2 records
|
||||
await click(getProgressBars(1)[0]);
|
||||
|
||||
assert.deepEqual(getCardTexts(0), ["4"]);
|
||||
assert.deepEqual(getCardTexts(1), ["1", "2"]);
|
||||
|
||||
// open a record
|
||||
await click(target.querySelectorAll(".o_kanban_record")[1]);
|
||||
assert.containsOnce(target, ".o_form_view");
|
||||
|
||||
// go back to kanban view
|
||||
await click(target.querySelector(".breadcrumb-item a"));
|
||||
|
||||
assert.deepEqual(getCardTexts(0), ["4"]);
|
||||
assert.deepEqual(getCardTexts(1), ["1", "2"]);
|
||||
|
||||
// open a record
|
||||
await click(target.querySelectorAll(".o_kanban_record")[1]);
|
||||
assert.containsOnce(target, ".o_form_view");
|
||||
|
||||
// select another state
|
||||
await click(target.querySelectorAll("input.o_radio_input")[1]);
|
||||
// go back to kanban view
|
||||
await click(target.querySelector(".breadcrumb-item a"));
|
||||
|
||||
assert.deepEqual(getCardTexts(0), ["4"]);
|
||||
assert.deepEqual(getCardTexts(1), ["2"]);
|
||||
});
|
||||
|
||||
QUnit.test(
|
||||
"folded groups are kept when leaving and coming back (grouped by date)",
|
||||
async (assert) => {
|
||||
|
||||
Reference in New Issue
Block a user