Before this commit, In the product form, when the selected uom is Hours and as Hours is the default uom, we display this conversion (1.0 Hours = 1.0 Hours) which is useless Before this commit, Kanban is the only view available for projects. With this view, we can't select a batch of projects and display optional fields Before this commit, Some wordings didn't have a significant meaning. This commit hides uom conversion when selected and default uom are the same. This commit adds the projects tree view. This commit improves some wordings according to what was mentionned in the task. task-2724965 closes odoo/odoo#82135 Related: odoo/enterprise#23206 Related: odoo/upgrade#3207 Signed-off-by: Laurent Stukkens (ltu) <ltu@odoo.com>
45 lines
1.6 KiB
Python
45 lines
1.6 KiB
Python
# -*- coding: utf-8 -*-
|
|
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
|
|
|
from . import controllers
|
|
from . import models
|
|
from . import report
|
|
|
|
from odoo import api, fields, SUPERUSER_ID, _
|
|
|
|
from odoo.addons.project import _check_exists_collaborators_for_project_sharing
|
|
|
|
|
|
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
|
|
project_ids = env['res.company'].search([])._create_internal_project_task()
|
|
env['account.analytic.line'].create([{
|
|
'name': _("Analysis"),
|
|
'user_id': admin.id,
|
|
'date': fields.datetime.today(),
|
|
'unit_amount': 0,
|
|
'project_id': task.project_id.id,
|
|
'task_id': task.id,
|
|
} for task in project_ids.task_ids.filtered(lambda t: t.company_id in admin.employee_ids.company_id)])
|
|
|
|
_check_exists_collaborators_for_project_sharing(env)
|
|
|
|
def _uninstall_hook(cr, registry):
|
|
env = api.Environment(cr, SUPERUSER_ID, {})
|
|
act_window = env.ref('project.open_view_project_all', raise_if_not_found=False)
|
|
if act_window and act_window.domain and 'is_internal_project' in act_window.domain:
|
|
act_window.domain = []
|
|
|
|
# archive the internal projects
|
|
project_ids = env['res.company'].search([('internal_project_id', '!=', False)]).mapped('internal_project_id')
|
|
if project_ids:
|
|
project_ids.write({'active': False})
|