[IMP] project: UX improvements
- Align colors of Project Update bubble's to kanban colors - Allow Project User to manage Project Updates TaskID: 2615316 Related: odoo/enterprise#20426 Related: odoo/upgrade#2773
This commit is contained in:
@@ -663,7 +663,7 @@ class Project(models.Model):
|
||||
|
||||
def _get_user_values(self):
|
||||
return {
|
||||
'is_project_manager': self.user_has_groups('project.group_project_manager'),
|
||||
'is_project_user': self.user_has_groups('project.group_project_user'),
|
||||
}
|
||||
|
||||
def _get_tasks_analysis(self):
|
||||
|
||||
@@ -8,9 +8,9 @@ from werkzeug.urls import url_encode
|
||||
from odoo import api, fields, models
|
||||
|
||||
STATUS_COLOR = {
|
||||
'on_track': 10, # green
|
||||
'on_track': 20, # green / success
|
||||
'at_risk': 2, # orange
|
||||
'off_track': 1, # red
|
||||
'off_track': 23, # red / danger
|
||||
'on_hold': 4, # light blue
|
||||
}
|
||||
|
||||
@@ -71,7 +71,7 @@ class ProjectUpdate(models.Model):
|
||||
@api.model
|
||||
def create(self, vals):
|
||||
update = super().create(vals)
|
||||
update.project_id.last_update_id = update
|
||||
update.project_id.sudo().last_update_id = update
|
||||
return update
|
||||
|
||||
# ---------------------------------
|
||||
|
||||
@@ -30,7 +30,7 @@ access_project_task_recurrence,project.task.recurrence,model_project_task_recurr
|
||||
project.access_project_task_burndown_chart_report,access_project_task_burndown_chart_report,project.model_project_task_burndown_chart_report,project.group_project_manager,1,1,1,1
|
||||
access_project_update_user,project.update.user,model_project_update,base.group_user,1,0,0,0
|
||||
access_project_update_portal,project.update.portal,model_project_update,base.group_portal,1,0,0,0
|
||||
access_project_update_project_user,project.update.project.user,model_project_update,project.group_project_user,1,0,0,0
|
||||
access_project_update_project_user,project.update.project.user,model_project_update,project.group_project_user,1,1,1,1
|
||||
access_project_update_project_manager,project.update.project.manager,model_project_update,project.group_project_manager,1,1,1,1
|
||||
access_project_milestone_user,project.milestone.user,model_project_milestone,base.group_user,1,0,0,0
|
||||
access_project_milestone_portal,project.milestone.portal,model_project_milestone,base.group_portal,1,0,0,0
|
||||
|
||||
|
@@ -32,7 +32,7 @@ export class ProjectControlPanel extends ControlPanel {
|
||||
method: 'get_last_update_or_default',
|
||||
args: [this.project_id],
|
||||
});
|
||||
this.is_project_manager = await session.user_has_group('project.group_project_manager');
|
||||
this.is_project_user = await session.user_has_group('project.group_project_user');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -7,6 +7,19 @@
|
||||
background-color: nth($o-colors, $size);
|
||||
}
|
||||
}
|
||||
|
||||
&.o_color_bubble_20 {
|
||||
background-color: $o-success;
|
||||
}
|
||||
&.o_color_bubble_21 {
|
||||
background-color: $o-info;
|
||||
}
|
||||
&.o_color_bubble_22 {
|
||||
background-color: $o-warning;
|
||||
}
|
||||
&.o_color_bubble_23 {
|
||||
background-color: $o-danger;
|
||||
}
|
||||
}
|
||||
|
||||
.o_status_with_color {
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
</div>
|
||||
|
||||
<t t-name="project.ControlPanelContentBadge" owl="1">
|
||||
<t t-tag="is_project_manager ? 'button' : 'span'" class="badge border d-flex p-2 ml-2 bg-white">
|
||||
<t t-tag="is_project_user ? 'button' : 'span'" class="badge border d-flex p-2 ml-2 bg-white">
|
||||
<span t-attf-class="o_status_bubble o_color_bubble_{{data.color}}"/>
|
||||
<span class="font-weight-normal ml-1" t-esc="data.status"/>
|
||||
</t>
|
||||
@@ -32,7 +32,7 @@
|
||||
|
||||
<t t-name="project.ControlPanelContent" owl="1">
|
||||
<t t-if="show_project_update">
|
||||
<li t-if="is_project_manager" class="o_project_updates_breadcrumb pl-3" t-on-click="onStatusClick">
|
||||
<li t-if="is_project_user" class="o_project_updates_breadcrumb pl-3" t-on-click="onStatusClick">
|
||||
<t t-call="project.ControlPanelContentBadge"></t>
|
||||
</li>
|
||||
<li t-else="" class="o_project_updates_breadcrumb pl-3">
|
||||
@@ -59,7 +59,7 @@
|
||||
|
||||
<div class="o_rightpanel_data">
|
||||
<div t-foreach="tasksAnalysis.data" t-as="analysis" t-key="analysis.name" class="o_rightpanel_data_row">
|
||||
<a t-if="state.data.user.is_project_manager" class="btn btn-link o_rightpanel_left_col o_rightpanel_left_button" t-on-click="onProjectActionClick"
|
||||
<a t-if="state.data.user.is_project_user" class="btn btn-link o_rightpanel_left_col o_rightpanel_left_button" t-on-click="onProjectActionClick"
|
||||
t-att-data-action="analysis.action.action"
|
||||
t-att-data-additional_context="analysis.action.additional_context"
|
||||
data-type="action">
|
||||
|
||||
@@ -25,7 +25,7 @@ class TestProjectUpdateAccessRights(TestProjectCommon):
|
||||
def test_project_update_user_can_read(self):
|
||||
self.project_update_1.with_user(self.env.user).name
|
||||
|
||||
@users('Project user', 'Base user')
|
||||
@users('Base user')
|
||||
def test_project_update_user_no_write(self):
|
||||
with self.assertRaises(AccessError, msg="%s should not be able to write in the project update" % self.env.user.name):
|
||||
self.project_update_1.with_user(self.env.user).name = "Test write"
|
||||
@@ -34,13 +34,7 @@ class TestProjectUpdateAccessRights(TestProjectCommon):
|
||||
def test_project_update_admin_can_write(self):
|
||||
self.project_update_1.with_user(self.env.user).name = "Test write"
|
||||
|
||||
@users('Project user')
|
||||
def test_project_update_user_project_owner_cannot_write(self):
|
||||
self.project_pigs.user_id = self.env.user
|
||||
with self.assertRaises(AccessError, msg="%s, who owns the project, should not be able to write in the project update" % self.env.user.name):
|
||||
self.project_update_1.with_user(self.env.user).name = "Test write"
|
||||
|
||||
@users('Project user', 'Base user')
|
||||
@users('Base user')
|
||||
def test_project_update_user_no_unlink(self):
|
||||
with self.assertRaises(AccessError, msg="%s should not be able to unlink in the project update" % self.env.user.name):
|
||||
self.project_update_1.with_user(self.env.user).unlink()
|
||||
@@ -48,9 +42,3 @@ class TestProjectUpdateAccessRights(TestProjectCommon):
|
||||
@users('Project admin')
|
||||
def test_project_update_admin_unlink(self):
|
||||
self.project_update_1.with_user(self.env.user).unlink()
|
||||
|
||||
@users('Project user')
|
||||
def test_project_update_user_project_owner_no_unlink(self):
|
||||
self.project_pigs.user_id = self.env.user
|
||||
with self.assertRaises(AccessError, msg="%s should not be able to unlink the project update even if project owner" % self.env.user.name):
|
||||
self.project_update_1.with_user(self.env.user).unlink()
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
</t>
|
||||
|
||||
<t t-name="sale_timesheet.ProfitabilitySection" owl="1">
|
||||
<t t-if="state.data.user.is_project_manager && state.data.profitability_items.data.length > 0">
|
||||
<t t-if="state.data.user.is_project_user && state.data.profitability_items.data.length > 0">
|
||||
<t t-set="profitability_items" t-value="state.data.profitability_items"/>
|
||||
<div class="o_rightpanel_section" name="profitability">
|
||||
<div class="o_rightpanel_header">
|
||||
|
||||
Reference in New Issue
Block a user