diff options
| author | Dominik Rubo <dru@odoo.com> | 2020-08-21 09:46:28 +0000 |
|---|---|---|
| committer | Yannick Tivisse <yti@odoo.com> | 2020-10-15 10:48:07 +0000 |
| commit | 8dd0edae898a532dbe7e4f18c9118b9b68e57900 (patch) | |
| tree | 80e5af6ddf28c117f5a4666353495e1c942ee9b7 /addons/hr_timesheet | |
| parent | 7ba0bc47d1404d5ac4bbf8cb5dcca7937558bd1a (diff) | |
[IMP] project: enable config-selected features in projects
This change ensures that when the user activates optional features of the
project app, they are enabled in existing projects as well as newly created
projects automatically, which is likely what the user expects.
For most optional features, this behavior was already in place. It was not in
place yet for the sub-tasks and timesheets features, which this change fixes.
Two added tests check the behavior described above for features that are
activated through a `group_*` field on `res.config.settings` (sub-tasks,
recurring tasks and ratings). The tests do not cover features that are
activated through a `module_*` field, as such fields require the installation
of further modules and we cannot simulate this.
Task 2297054
closes odoo/odoo#58692
Related: odoo/enterprise#13641
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
Co-authored-by: Kevin Baptiste <50135801+kba-odoo@users.noreply.github.com>
Diffstat (limited to 'addons/hr_timesheet')
| -rw-r--r-- | addons/hr_timesheet/__init__.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/addons/hr_timesheet/__init__.py b/addons/hr_timesheet/__init__.py index 6aab6c417a5..0fa9235b104 100644 --- a/addons/hr_timesheet/__init__.py +++ b/addons/hr_timesheet/__init__.py @@ -11,6 +11,11 @@ from odoo import api, fields, SUPERUSER_ID, _ def create_internal_project(cr, registry): env = api.Environment(cr, SUPERUSER_ID, {}) + + # allow_timesheets is set by default, but erased for existing projects at + # installation, as there is no analytic account for them. + env['project.project'].search([]).write({'allow_timesheets': True}) + admin = env.ref('base.user_admin', raise_if_not_found=False) if not admin: return |
