1 # -*- coding: utf-8 -*-
2 ##############################################################################
4 # OpenERP, Open Source Business Applications
5 # Copyright (C) 2004-2012 OpenERP S.A. (<http://openerp.com>).
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.
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.
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/>.
20 ##############################################################################
22 from openerp.osv import fields, osv
23 from openerp.tools.translate import _
25 class project_configuration(osv.osv_memory):
26 _name = 'project.config.settings'
27 _inherit = 'res.config.settings'
30 'module_project_mrp': 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 project_mrp.'),
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_long_term': fields.boolean("Manage resources planning on gantt view",
45 help='A long term project management module that tracks planning, scheduling, and resource allocation.\n'
46 '-This installs the module project_long_term.'),
47 'module_project_issue': fields.boolean("Track issues and bugs",
48 help='Provides management of issues/bugs in projects.\n'
49 '-This installs the module project_issue.'),
50 'time_unit': fields.many2one('product.uom', 'Working time unit', required=True,
51 help="""This will set the unit of measure used in projects and tasks."""),
52 'module_project_issue_sheet': fields.boolean("Invoice working time on issues",
53 help='Provides timesheet support for the issues/bugs management in project.\n'
54 '-This installs the module project_issue_sheet.'),
55 'group_tasks_work_on_tasks': fields.boolean("Log work activities on tasks",
56 implied_group='project.group_tasks_work_on_tasks',
57 help="Allows you to compute work on tasks."),
58 'group_time_work_estimation_tasks': fields.boolean("Manage time estimation on tasks",
59 implied_group='project.group_time_work_estimation_tasks',
60 help="Allows you to compute Time Estimation on tasks."),
61 'group_manage_delegation_task': fields.boolean("Allow task delegation",
62 implied_group='project.group_delegate_task',
63 help="Allows you to delegate tasks to other users."),
66 def get_default_time_unit(self, cr, uid, fields, context=None):
67 user = self.pool.get('res.users').browse(cr, uid, uid, context=context)
68 return {'time_unit': user.company_id.project_time_mode_id.id}
70 def set_time_unit(self, cr, uid, ids, context=None):
71 config = self.browse(cr, uid, ids[0], context)
72 user = self.pool.get('res.users').browse(cr, uid, uid, context)
73 user.company_id.write({'project_time_mode_id': config.time_unit.id})
75 def onchange_time_estimation_project_timesheet(self, cr, uid, ids, group_time_work_estimation_tasks, module_project_timesheet):
76 if group_time_work_estimation_tasks or module_project_timesheet:
77 return {'value': {'group_tasks_work_on_tasks': True}}
80 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: