summaryrefslogtreecommitdiff
path: root/addons/project_long_term/project_long_term.py
diff options
context:
space:
mode:
authorAntonin Bourguignon <abo@openerp.com>2012-09-24 15:57:04 +0200
committerAntonin Bourguignon <abo@openerp.com>2012-09-24 15:57:04 +0200
commit3049f0a2a8633e04ef1dde7103ec1d422e3ef58c (patch)
tree1be9a340a7a4fcb06557bf399858db1e33eb9af3 /addons/project_long_term/project_long_term.py
parentf9c2437959fba731b808208e184d86f51f2db600 (diff)
parentdfeeca1e8fd702bddd7ace33090d99395c485811 (diff)
[MERGE] trunk
bzr revid: abo@openerp.com-20120924135704-neh93vull9m35qhs
Diffstat (limited to 'addons/project_long_term/project_long_term.py')
-rw-r--r--addons/project_long_term/project_long_term.py30
1 files changed, 23 insertions, 7 deletions
diff --git a/addons/project_long_term/project_long_term.py b/addons/project_long_term/project_long_term.py
index 8d9319466e3..2eab5fa6ac6 100644
--- a/addons/project_long_term/project_long_term.py
+++ b/addons/project_long_term/project_long_term.py
@@ -114,8 +114,8 @@ class project_phase(osv.osv):
'task_ids': fields.one2many('project.task', 'phase_id', "Project Tasks", states={'done':[('readonly',True)], 'cancelled':[('readonly',True)]}),
'user_force_ids': fields.many2many('res.users', string='Force Assigned Users'),
'user_ids': fields.one2many('project.user.allocation', 'phase_id', "Assigned Users",states={'done':[('readonly',True)], 'cancelled':[('readonly',True)]},
- help="The ressources on the project can be computed automatically by the scheduler"),
- 'state': fields.selection([('draft', 'New'), ('open', 'In Progress'), ('pending', 'Pending'), ('cancelled', 'Cancelled'), ('done', 'Done')], 'State', readonly=True, required=True,
+ help="The resources on the project can be computed automatically by the scheduler."),
+ 'state': fields.selection([('draft', 'New'), ('cancelled', 'Cancelled'),('open', 'In Progress'), ('pending', 'Pending'), ('done', 'Done')], 'Status', readonly=True, required=True,
help='If the phase is created the state \'Draft\'.\n If the phase is started, the state becomes \'In Progress\'.\n If review is needed the phase is in \'Pending\' state.\
\n If the phase is over, the states is set to \'Done\'.'),
'progress': fields.function(_compute_progress, string='Progress', help="Computed based on related tasks"),
@@ -225,13 +225,9 @@ class project(osv.osv):
_columns = {
'phase_ids': fields.one2many('project.phase', 'project_id', "Project Phases"),
- 'use_phases': fields.boolean('Use Phases', help="Check this field if project manages phases"),
'phase_count': fields.function(_phase_count, type='integer', string="Open Phases"),
}
- _defaults = {
- 'use_phases': True,
- }
-
+
def schedule_phases(self, cr, uid, ids, context=None):
context = context or {}
if type(ids) in (long, int,):
@@ -273,6 +269,26 @@ class project(osv.osv):
return True
project()
+class account_analytic_account(osv.osv):
+ _inherit = 'account.analytic.account'
+ _description = 'Analytic Account'
+ _columns = {
+ 'use_phases': fields.boolean('Phases', help="Check this field if you plan to use phase-based scheduling"),
+ }
+
+ def on_change_template(self, cr, uid, ids, template_id, context=None):
+ res = super(account_analytic_account, self).on_change_template(cr, uid, ids, template_id, context=context)
+ if template_id and 'value' in res:
+ template = self.browse(cr, uid, template_id, context=context)
+ res['value']['use_phases'] = template.use_phases
+ return res
+
+ def _trigger_project_creation(self, cr, uid, vals, context=None):
+ res= super(account_analytic_account, self)._trigger_project_creation(cr, uid, vals, context=context)
+ return res or vals.get('use_phases')
+
+account_analytic_account()
+
class project_task(osv.osv):
_inherit = "project.task"
_columns = {