Skip to content

Commit

Permalink
[FIX] project: add project_time_mode_id
Browse files Browse the repository at this point in the history
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
  • Loading branch information
nim-odoo committed Jan 23, 2018
1 parent f68ad51 commit eaa73be
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions addons/project/models/res_company.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.")
5 changes: 5 additions & 0 deletions addons/project/models/res_config_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.")
4 changes: 4 additions & 0 deletions addons/project/views/res_config_settings_views.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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">
Expand Down

0 comments on commit eaa73be

Please sign in to comment.