[IMP] project: improve ux

Before this commit:
- When a project is created on SO confirmation,
the new project (assuming there is no project template
set on the product) is added with one stage with name=New
- When portal users drag & drop columns from the kanban view
of project.task, an access rights error is displayed.

After this commit:
- When a project is created on SO confirmation,
set the following stages for the new project
(assuming there is no project template set on the product):
to do - in progress - done (folded) - canceled (folded).
- Disable dragging and dropping project tasks for portal
user.

task-2929871

closes odoo/odoo#97220

Related: odoo/enterprise#29911
Signed-off-by: Xavier Bol (xbo) <xbo@odoo.com>
This commit is contained in:
Raouf
2023-06-05 13:30:52 +02:00
parent ae17a588a7
commit a35e8fb67a
2 changed files with 11 additions and 1 deletions
@@ -27,6 +27,7 @@
quick_create_view="project.project_sharing_quick_create_task_form"
archivable="0"
import="0"
groups_draggable="0"
>
<field name="color"/>
<field name="priority"/>
+10 -1
View File
@@ -144,7 +144,16 @@ class SaleOrderLine(models.Model):
# Avoid new tasks to go to 'Undefined Stage'
if not project.type_ids:
project.type_ids = self.env['project.task.type'].create({'name': _('New')})
project.type_ids = self.env['project.task.type'].create([{
'name': name,
'fold': fold,
'sequence': sequence,
} for name, fold, sequence in [
(_('To Do'), False, 5),
(_('In Progress'), False, 10),
(_('Done'), True, 15),
(_('Canceled'), True, 20),
]])
# link project as generated by current so line
self.write({'project_id': project.id})