summaryrefslogtreecommitdiff
path: root/addons/project_long_term/project_long_term.py
diff options
context:
space:
mode:
authorTurkesh Patel (Open ERP) <tpa@tinyerp.com>2012-08-23 14:44:48 +0530
committerTurkesh Patel (Open ERP) <tpa@tinyerp.com>2012-08-23 14:44:48 +0530
commit2bebc58b90c0d8e31c7b52fd2157220b89b341b8 (patch)
treebd1a5eb12d1de90b0c6703fdac1c2305cb40a0fa /addons/project_long_term/project_long_term.py
parentda13d90912fb12bd8f82a12300325f6f57dfee17 (diff)
parentc4b2e9fad2ce2bd2c59aae3d96eb467177b3c7ca (diff)
[MRG] merge with lp:openobject-addons
bzr revid: tpa@tinyerp.com-20120823091448-ouxbelky1i1n2273
Diffstat (limited to 'addons/project_long_term/project_long_term.py')
-rw-r--r--addons/project_long_term/project_long_term.py28
1 files changed, 22 insertions, 6 deletions
diff --git a/addons/project_long_term/project_long_term.py b/addons/project_long_term/project_long_term.py
index 19d58f101ef..d5ac3868a5e 100644
--- a/addons/project_long_term/project_long_term.py
+++ b/addons/project_long_term/project_long_term.py
@@ -114,7 +114,7 @@ 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"),
+ 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\'.'),
@@ -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 Planing', help="Check this field if project manages phases"),
+ }
+
+ 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 = {