summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoratp (Open ERP) <atp@tinyerp.co.in>2011-01-04 19:05:15 +0530
committeratp (Open ERP) <atp@tinyerp.co.in>2011-01-04 19:05:15 +0530
commitb1fa3dee7d5a7f3c439375f934d6f7762e9ffd02 (patch)
treebe0d1c448fbb587fda58b90431e293a9682373a6
parent538473343f968b9b58907005121ea25b6f86389a (diff)
[FIX]: Fix constrain date problem of project phase.
bzr revid: atp@tinyerp.co.in-20110104133515-3b2ptv3jf0neq75c
-rw-r--r--addons/project_long_term/__openerp__.py2
-rw-r--r--addons/project_long_term/project_long_term.py7
2 files changed, 6 insertions, 3 deletions
diff --git a/addons/project_long_term/__openerp__.py b/addons/project_long_term/__openerp__.py
index 586c5efccd1..74837a41af1 100644
--- a/addons/project_long_term/__openerp__.py
+++ b/addons/project_long_term/__openerp__.py
@@ -40,7 +40,7 @@ Features.
"init_xml": [],
"demo_xml": ["project_long_term_demo.xml"],
"test": [
- 'test/test_project_long_term.yml',
+ 'test/test_project_long_term.yml',
'test/schedule_project_phases.yml',
'test/schedule_project_tasks.yml',
'test/schedule_phase_tasks.yml',
diff --git a/addons/project_long_term/project_long_term.py b/addons/project_long_term/project_long_term.py
index da0978d3535..da4b256f82f 100644
--- a/addons/project_long_term/project_long_term.py
+++ b/addons/project_long_term/project_long_term.py
@@ -220,6 +220,7 @@ class project_phase(osv.osv):
resource_pool = self.pool.get('resource.resource')
for phase in self.browse(cr, uid, ids, context=context):
user_ids = map(lambda x:x.resource_id.user_id.id, phase.resource_ids)
+
project = phase.project_id
calendar_id = project.resource_calendar_id and project.resource_calendar_id.id or False
resource_objs = resource_pool.generate_resources(cr, uid, user_ids, calendar_id, context=context)
@@ -240,12 +241,13 @@ class project_phase(osv.osv):
uom_pool = self.pool.get('product.uom')
data_model, day_uom_id = data_pool.get_object_reference(cr, uid, 'product', 'uom_day')
for phase in self.browse(cr, uid, ids, context=context):
+ if not phase.previous_phase_ids:
+ start_date = False
if not phase.responsible_id:
raise osv.except_osv(_('No responsible person assigned !'),_("You must assign a responsible person for phase '%s' !") % (phase.name,))
-
if not start_date:
start_date = phase.project_id.date_start or phase.date_start or datetime.now().strftime("%Y-%m-%d")
- start_date = datetime.strftime((datetime.strptime(start_date, "%Y-%m-%d")), "%Y-%m-%d")
+ start_date = datetime.strftime((datetime.strptime(start_date, "%Y-%m-%d")), "%Y-%m-%d")
phase_resource_obj = self.generate_resources(cr, uid, [phase.id], context=context)[phase.id]
avg_days = uom_pool._compute_qty(cr, uid, phase.product_uom.id, phase.duration, day_uom_id)
if not phase_resource_obj: #TOCHECK: why need this ?
@@ -277,6 +279,7 @@ class project_phase(osv.osv):
start_date = datetime.strptime(phase.constraint_date_start, '%Y-%m-%d')
else:
start_date = s_date
+
if phase.constraint_date_end and str(e_date) > phase.constraint_date_end:
end_date= datetime.strptime(phase.constraint_date_end, '%Y-%m-%d')
date_start = phase.constraint_date_end