[FIX] board, project: Allow user to add project_graph to dashboard

If we add the graph view of project in the dashboard
And we access the dashboard a traceback appears

Cause: Unable to evaluate the context because the following information
is missing: "active_id" which is used in the domain

https://github.com/odoo/odoo/blob/4d864c05dfa8f9be25d41bbae318f75a61d0cde2/addons/board/static/src/legacy/js/board_view.js#L254

the solution is to add `globalContext` to the `contextToSave`

https://github.com/odoo/odoo/blob/7e77bb74bfa1bfef92c6d385dedc2d89e0040780/addons/board/static/src/add_to_board/add_to_board.js#L37-L43

`View` is `undefined` because the `project_graph` view is made with OWL
and board is still in legacy

https://github.com/odoo/odoo/blob/4d864c05dfa8f9be25d41bbae318f75a61d0cde2/addons/board/static/src/legacy/js/board_view.js#L274

Since https://github.com/odoo/odoo/pull/84864

The solution is to add a legacy version of the `project_graph`

Apply the same fix for `project_pivot`

opw-2791672

closes odoo/odoo#87883

X-original-commit: 8999277e668f666bc650d508384c4a07ea6c711e
Signed-off-by: Achraf <abz@odoo.com>
This commit is contained in:
Achraf (abz)
2022-04-04 14:45:26 +02:00
parent cccb235794
commit cfccd028b3
4 changed files with 31 additions and 1 deletions
@@ -35,9 +35,10 @@ export class AddToBoard extends Component {
//---------------------------------------------------------------------
async addToBoard() {
const { domain } = this.env.searchModel;
const { domain, globalContext } = this.env.searchModel;
const { context } = this.env.searchModel.getIrFilterValues();
const contextToSave = {
...globalContext,
...context,
orderedBy: this.env.searchModel.orderBy,
dashboard_merge_domains_contexts: false,
+3
View File
@@ -88,6 +88,9 @@
'project/static/src/scss/project_rightpanel.scss',
'project/static/src/scss/project_widgets.scss',
],
"web.assets_backend_legacy_lazy": [
'project/static/src/js/*_legacy.js',
],
'web.assets_frontend': [
'project/static/src/scss/portal_rating.scss',
'project/static/src/js/portal_rating.js',
@@ -0,0 +1,13 @@
/** @odoo-module **/
import GraphView from 'web.GraphView';
import { ProjectControlPanel } from '@project/js/project_control_panel';
import viewRegistry from 'web.view_registry';
export const ProjectGraphView = GraphView.extend({
config: Object.assign({}, GraphView.prototype.config, {
ControlPanel: ProjectControlPanel,
}),
});
viewRegistry.add('project_graph', ProjectGraphView);
@@ -0,0 +1,13 @@
/** @odoo-module **/
import PivotView from 'web.PivotView';
import { ProjectControlPanel } from '@project/js/project_control_panel';
import viewRegistry from 'web.view_registry';
export const ProjectPivotView = PivotView.extend({
config: Object.assign({}, PivotView.prototype.config, {
ControlPanel: ProjectControlPanel,
}),
});
viewRegistry.add('project_pivot', ProjectPivotView);