odoo/odoo#163594

Created by fw-bot
label
odoo-dev:17.0-saas-16.4-opw-3800071-huvw-qSZT-fw
head
40f30f8320c0b5b309ab383b80e6222f660ebbd1
target
17.0
merged
3 weeks ago by Hubert Van De Walle
forward-port of
odoo/odoo#163170

[FW][FIX] sale_project: editable views for action_view_task

Steps to reproduce
==================

- Install sale_project,industry_fsm,web_studio
- Open quotation S00023
- Click on the Tasks stat button
- Open studio
- Go to views
- Enable the gantt view

=> Unable to complete the operation: duplicate key value violates unique constraint "act_window_view_unique_mode_per_action"

Cause of the issue
==================

The [action record] already contains the gantt view, but it is replaced inside the python [action].

In [previous] version, the user was entering this condition and thus had no problem editing the views

Solution
========

Instead of replacing the entire action['views'], we can remap the view ids to the ones we want.

One side effect of this though is that the `gantt,activity,map` views will be available by default.

---

[action record]: https://github.com/odoo/enterprise/blob/1df090289f3c45c200d133734989a6d9a8073145/project_enterprise/views/project_task_views.xml#L227
[action]: https://github.com/odoo/odoo/blob/1a9302dc3a9b0d9323612c10e0f3a91300bb89fd/addons/sale_project/models/sale_order.py#L154
[previous]: https://github.com/odoo/odoo/blob/8dbcd3d955e7270fc26a6141e8fce751029e5a4b/addons/sale_project/models/sale_order.py#L133-L141

opw-3800071

Forward-Port-Of: odoo/odoo#163170