[IMP] hr_timesheet: access logic

Fix various incoherences related to timesheets :

- Hide the progress field on the task form view if user hasn't
- timesheet user access.  Remove the possibility to link a new
   timesheet to a task belonging to a project not allowing timesheets.

Task-2066533

closes odoo/odoo#36475

Signed-off-by: Jérome Maes (jem) <jem@openerp.com>
This commit is contained in:
Geoffroy Larue
2019-09-19 09:26:27 +00:00
parent c48648a7a5
commit 7294c377db
2 changed files with 5 additions and 1 deletions
@@ -41,6 +41,10 @@ class AccountAnalyticLine(models.Model):
return {'domain': {
'task_id': [('project_id', '=', self.project_id.id)]
}}
return {'domain': {
'task_id': [('project_id.allow_timesheets', '=', True)]
}}
@api.onchange('task_id')
def _onchange_task_id(self):
+1 -1
View File
@@ -162,7 +162,7 @@
<field name="user_id" position="after">
<field name="planned_hours" widget="float_time" sum="Initially Planned Hours" optional="show"/>
<field name="remaining_hours" widget="float_time" sum="Remaining Hours" readonly="1" optional="show"/>
<field name="progress" widget="progressbar" optional="show"/>
<field name="progress" widget="progressbar" optional="show" groups="hr_timesheet.group_hr_timesheet_user"/>
<field name="effective_hours" widget="float_time" sum="Spent Hours" invisible="1"/>
</field>
</field>