[FIX] project: add project_time_mode_id

When creating a new company, it was not possible to set the 'Project
Time Unit'.

Add the field in the settings and add a default value.

opw-805533
This commit is contained in:
Nicolas Martinelli
2018-01-23 11:03:18 +01:00
committed by Nicolas Martinelli
parent f68ad51520
commit eaa73beaaa
3 changed files with 10 additions and 0 deletions
+1
View File
@@ -8,6 +8,7 @@ class ResCompany(models.Model):
_inherit = 'res.company'
project_time_mode_id = fields.Many2one('product.uom', string='Project Time Unit',
default=lambda s: s.env.ref('product.product_uom_hour', raise_if_not_found=False),
help="This will set the unit of measure used in projects and tasks.\n"
"If you use the timesheet linked to projects, don't "
"forget to setup the right unit of measure in your employees.")
@@ -11,3 +11,8 @@ class ResConfigSettings(models.TransientModel):
module_rating_project = fields.Boolean(string="Rating on Tasks")
module_project_forecast = fields.Boolean(string="Forecasts")
group_subtask_project = fields.Boolean("Sub-tasks", implied_group="project.group_subtask_project")
project_time_mode_id = fields.Many2one(
'product.uom', related='company_id.project_time_mode_id', string='Project Time Unit',
help="This will set the unit of measure used in projects and tasks.\n"
"If you use the timesheet linked to projects, don't "
"forget to setup the right unit of measure in your employees.")
@@ -56,6 +56,10 @@
<div class="text-muted">
Track time spent on projects and tasks
</div>
<div class="row mt16" attrs="{'invisible':['|', ('module_hr_timesheet', '=', False), ('project_time_mode_id', '!=', False)]}">
<label for="project_time_mode_id" class="col-md-3 o_light_label"/>
<field name="project_time_mode_id" options="{'no_create': True, 'no_open': True}"/>
</div>
</div>
</div>
<div class="col-xs-12 col-md-6 o_setting_box">