Skip to content
Snippets Groups Projects
Commit 7e41555d authored by Ivan Yelizariev's avatar Ivan Yelizariev
Browse files

[FIX] board: use correct tree view id

`board` module allows adding current tree view to My Dashboard menu. It copies
some settings (context, domain, etc.), but not the list view id. Because of
that, default list view is used. However, the default list view might be
different from what user sees in original menu. For example, there are two tree
views for `purchase.order`:

`purchase_order_tree`
https://github.com/odoo/odoo/blob/6b101d5ff0ad78b9ae2ad312f362c2224e7af457/addons/purchase/views/purchase_views.xml#L535

`purchase_order_view_tree`
https://github.com/odoo/odoo/blob/6b101d5ff0ad78b9ae2ad312f362c2224e7af457/addons/purchase/views/purchase_views.xml#L599

But only one of them has field `receipt_status`
https://github.com/odoo/odoo/blob/6b101d5ff0ad78b9ae2ad312f362c2224e7af457/addons/purchase_stock/views/purchase_views.xml#L91



So, that field wasn't available in the Dashboard, which is quite annoying.

Fix it by forcing `viewId`.

STEPS:
- Click on Purchase App > Go to 'Purchase Orders'
- enable all the columns to show in listview (from that 2 arrows of listview on right side corner)
- Once you enable visibility of all columns in listview for Purchase orders list. Just Go to Favourites -> Save to Dashboard, give any name
- Reload the browser.
- Open Dashboard , go to My Dashboard
- Now see the customer dashboard which you create with certain columns is not visible in this Dashboard listview. and no way to make it visible even.

opw-3130088

closes odoo/odoo#111470

Signed-off-by: default avatarAaron Bohy (aab) <aab@odoo.com>
parent 9f8c69c6
No related branches found
No related tags found
No related merge requests found
......@@ -36,6 +36,11 @@ export class BoardAction extends Component {
display: { controlPanel: false },
selectRecord: (resId) => this.selectRecord(result.res_model, resId),
};
const view = result.views.find((v) => v[1] === viewMode);
if (view) {
this.viewProps.viewId = view[0];
}
if (action.context) {
this.viewProps.context = makeContext([
action.context,
......
......@@ -87,7 +87,7 @@ QUnit.module("Board", (hooks) => {
});
QUnit.test("basic functionality, with one sub action", async function (assert) {
assert.expect(21);
assert.expect(23);
serverData.views["partner,4,list"] = '<tree string="Partner"><field name="foo"/></tree>';
await makeView({
serverData,
......@@ -130,6 +130,9 @@ QUnit.module("Board", (hooks) => {
assert.step("edit custom");
return Promise.resolve(true);
}
if (args.method === "get_views" && args.model == "partner") {
assert.deepEqual(args.kwargs.views.find((v) => v[1] === 'list'), [4, "list"]);
}
},
});
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment