[FIX] project,project_issue: display order
[odoo/odoo.git] / addons / project / res_config.py
1 # -*- coding: utf-8 -*-
2 ##############################################################################
3 #
4 #    OpenERP, Open Source Business Applications
5 #    Copyright (C) 2004-2012 OpenERP S.A. (<http://openerp.com>).
6 #
7 #    This program is free software: you can redistribute it and/or modify
8 #    it under the terms of the GNU Affero General Public License as
9 #    published by the Free Software Foundation, either version 3 of the
10 #    License, or (at your option) any later version.
11 #
12 #    This program is distributed in the hope that it will be useful,
13 #    but WITHOUT ANY WARRANTY; without even the implied warranty of
14 #    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 #    GNU Affero General Public License for more details.
16 #
17 #    You should have received a copy of the GNU Affero General Public License
18 #    along with this program.  If not, see <http://www.gnu.org/licenses/>.
19 #
20 ##############################################################################
21
22 from openerp.osv import fields, osv
23 from openerp.tools.translate import _
24
25 class project_configuration(osv.osv_memory):
26     _name = 'project.config.settings'
27     _inherit = 'res.config.settings'
28
29     _columns = {
30         'module_sale_service': fields.boolean('Generate tasks from sale orders',
31             help='This feature automatically creates project tasks from service products in sale orders. '
32                  'More precisely, tasks are created for procurement lines with product of type \'Service\', '
33                  'procurement method \'Make to Order\', and supply method \'Manufacture\'.\n'
34                  '-This installs the module sale_service.'),
35         'module_pad': fields.boolean("Use integrated collaborative note pads on task",
36             help='Lets the company customize which Pad installation should be used to link to new pads '
37                  '(for example: http://ietherpad.com/).\n'
38                  '-This installs the module pad.'),
39         'module_project_timesheet': fields.boolean("Record timesheet lines per tasks",
40             help='This allows you to transfer the entries under tasks defined for Project Management to '
41                  'the timesheet line entries for particular date and user, with the effect of creating, '
42                  'editing and deleting either ways.\n'
43                  '-This installs the module project_timesheet.'),
44         'module_project_issue': fields.boolean("Track issues and bugs",
45             help='Provides management of issues/bugs in projects.\n'
46                  '-This installs the module project_issue.'),
47         'time_unit': fields.many2one('product.uom', 'Working time unit', required=True,
48             help="""This will set the unit of measure used in projects and tasks."""),
49         'module_project_issue_sheet': fields.boolean("Invoice working time on issues",
50             help='Provides timesheet support for the issues/bugs management in project.\n'
51                  '-This installs the module project_issue_sheet.'),
52         'group_tasks_work_on_tasks': fields.boolean("Log work activities on tasks",
53             implied_group='project.group_tasks_work_on_tasks',
54             help="Allows you to compute work on tasks."),
55         'group_time_work_estimation_tasks': fields.boolean("Manage time estimation on tasks",
56             implied_group='project.group_time_work_estimation_tasks',
57             help="Allows you to compute Time Estimation on tasks."),
58         'group_manage_delegation_task': fields.boolean("Allow task delegation",
59             implied_group='project.group_delegate_task',
60             help="Allows you to delegate tasks to other users."),
61     }
62
63     def get_default_time_unit(self, cr, uid, fields, context=None):
64         user = self.pool.get('res.users').browse(cr, uid, uid, context=context)
65         return {'time_unit': user.company_id.project_time_mode_id.id}
66
67     def set_time_unit(self, cr, uid, ids, context=None):
68         config = self.browse(cr, uid, ids[0], context)
69         user = self.pool.get('res.users').browse(cr, uid, uid, context)
70         user.company_id.write({'project_time_mode_id': config.time_unit.id})
71
72     def onchange_time_estimation_project_timesheet(self, cr, uid, ids, group_time_work_estimation_tasks, module_project_timesheet):
73         if group_time_work_estimation_tasks or module_project_timesheet:
74             return {'value': {'group_tasks_work_on_tasks': True}}
75         return {}
76
77 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: