[FIX] sale_timesheet: overview access

On sales order form view, we display a "project overview"
stat button. It redirects to the overview of the only
billable project of the SO.
To avoid access error, and because this dahsboard is usefull
only for project manager, only those ones will have access to
this overview. So, stat button (Sales order) and label on
project kanban are aonly visible for manager.
This commit is contained in:
jem-odoo
2018-05-04 13:22:25 +02:00
parent a7b6462de8
commit 36b9899ec6
3 changed files with 3 additions and 3 deletions
+1 -1
View File
@@ -88,7 +88,7 @@ class SaleOrder(models.Model):
self.ensure_one()
# redirect to form or kanban view
billable_projects = self.project_ids.filtered(lambda project: project.sale_line_id)
if len(billable_projects) == 1:
if len(billable_projects) == 1 and self.env.user.has_group('project.group_project_manager'):
action = billable_projects[0].action_view_timesheet_plan()
else:
view_form_id = self.env.ref('project.edit_project').id
@@ -7,7 +7,7 @@
<field name="inherit_id" ref="hr_timesheet.view_project_kanban_inherited"/>
<field name="arch" type="xml">
<xpath expr="//a[@t-if='record.allow_timesheets.raw_value']" position="replace">
<a t-if="record.allow_timesheets.raw_value" name="action_view_timesheet" type="object" class="o_project_kanban_box o_project_timesheet_box" groups="hr_timesheet.group_hr_timesheet_user">
<a t-if="record.allow_timesheets.raw_value" name="action_view_timesheet" type="object" class="o_project_kanban_box o_project_timesheet_box" groups="project.group_project_manager">
<div>
<span class="o_label">Overview</span>
</div>
@@ -23,7 +23,7 @@
icon="fa-puzzle-piece"
string="Project(s) Overview"
attrs="{'invisible': [('project_ids', '=', [])]}"
groups="project.group_project_user">
groups="project.group_project_manager">
<field name="project_ids" invisible="1"/>
</button>
</xpath>