From 01c8727ff4e8ee6ac80c2e81c1e0273e48ce0c73 Mon Sep 17 00:00:00 2001 From: hiroh-odoo Date: Tue, 22 Nov 2022 13:42:14 +0000 Subject: [PATCH] [FIX] sale_project : fix the SOL click on project update Currently, when we click on SOL and having one record of stock.move or timesheet then it was not going to display the form view of that particular record and also not showing that single record on list view too due to the invalid view_type passed in doActionButton. So in this commit, if res_id exist then open the form view of particular record. PS: we can not pass the options inside the doActionButton so we can not change the viewType from that method. second we have only action_id instead of whole action data so we can not directly switch the views without rpc call. task-2992368 closes odoo/odoo#109111 X-original-commit: 2cda1de1a924b7e81278f01ee0fd693be930a47f Signed-off-by: Xavier Bol (xbo) --- .../project_right_side_panel.js | 24 ++++++++++++++++++- .../project_right_side_panel.xml | 2 +- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/addons/sale_project/static/src/components/project_right_side_panel/project_right_side_panel.js b/addons/sale_project/static/src/components/project_right_side_panel/project_right_side_panel.js index b3788d30540..bc3104fc77c 100644 --- a/addons/sale_project/static/src/components/project_right_side_panel/project_right_side_panel.js +++ b/addons/sale_project/static/src/components/project_right_side_panel/project_right_side_panel.js @@ -29,5 +29,27 @@ patch(ProjectRightSidePanel.prototype, '@sale_project/components/project_right_s formatValue(value, unit) { return unit === 'Hours' ? formatFloatTime(value) : formatFloat(value); - } + }, + + //--------------------------------------------------------------------- + // Handlers + //--------------------------------------------------------------------- + + /** + * @private + * @param {Object} params + */ + async onSaleItemActionClick(params) { + if (params.resId && params.type !== 'object') { + const action = await this.actionService.loadAction(params.name, this.context); + this.actionService.doAction({ + ...action, + res_id: params.resId, + views: [[false, 'form']] + }); + } else { + this.onProjectActionClick(params); + } + }, + }); diff --git a/addons/sale_project/static/src/components/project_right_side_panel/project_right_side_panel.xml b/addons/sale_project/static/src/components/project_right_side_panel/project_right_side_panel.xml index a05219d83ab..91ae7ba9ea9 100644 --- a/addons/sale_project/static/src/components/project_right_side_panel/project_right_side_panel.xml +++ b/addons/sale_project/static/src/components/project_right_side_panel/project_right_side_panel.xml @@ -24,7 +24,7 @@ - +