[FIX] project_long_term: In scheduling phase, screnario to take start date: phase start date or project start date or system current date
bzr revid: hmo@tinyerp.com-20101230085144-ms3603jjatcaormk
This commit is contained in:
parent
22c847d00c
commit
a8e1beba5e
|
@ -282,10 +282,10 @@ class project_phase(osv.osv):
|
|||
res[phase.id] = resource_objs
|
||||
return res
|
||||
|
||||
def generate_schedule(self, cr, uid, ids, start_date, calendar_id=False, context=None):
|
||||
def generate_schedule(self, cr, uid, ids, start_date=False, calendar_id=False, context=None):
|
||||
"""
|
||||
Schedule phase with the start date till all the next phases are completed.
|
||||
@param: start_dsate : start date for the phase
|
||||
@param: start_date (datetime.datetime) : start date for the phase. It would be either Start date of phase or start date of project or system current date
|
||||
@param: calendar_id : working calendar of the project
|
||||
"""
|
||||
if context is None:
|
||||
|
@ -298,6 +298,9 @@ class project_phase(osv.osv):
|
|||
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")
|
||||
phase_resource_obj = resource_pool.generate_resources(cr, uid, [phase.responsible_id.id], calendar_id, context=context)
|
||||
avg_hours = uom_pool._compute_qty(cr, uid, phase.product_uom.id, phase.duration, default_uom_id)
|
||||
duration = str(avg_hours) + 'H'
|
||||
|
@ -440,12 +443,9 @@ class project(osv.osv):
|
|||
('state', 'in', ['draft', 'open', 'pending']),
|
||||
('previous_phase_ids', '=', False)
|
||||
])
|
||||
start_date = project.date_start
|
||||
if not start_date:
|
||||
start_date = datetime.now().strftime("%Y-%m-%d")
|
||||
start_dt = datetime.strftime((datetime.strptime(start_date, "%Y-%m-%d")), "%Y-%m-%d %H:%M")
|
||||
calendar_id = project.resource_calendar_id and project.resource_calendar_id.id or False
|
||||
phase_pool.generate_schedule(cr, uid, phase_ids, start_dt, calendar_id, context=context)
|
||||
start_date = False
|
||||
phase_pool.generate_schedule(cr, uid, phase_ids, start_date, calendar_id, context=context)
|
||||
return True
|
||||
|
||||
def schedule_tasks(self, cr, uid, ids, context=None):
|
||||
|
|
|
@ -299,7 +299,7 @@ class resource_resource(osv.osv):
|
|||
leave_list.sort()
|
||||
return leave_list
|
||||
|
||||
def compute_working_calendar(cr, uid, calendar_id, context=None):
|
||||
def compute_working_calendar(self, cr, uid, calendar_id, context=None):
|
||||
"""
|
||||
Change the format of working calendar from 'Openerp' format to bring it into 'Faces' format.
|
||||
@param calendar_id : working calendar of the project
|
||||
|
@ -321,8 +321,8 @@ class resource_resource(osv.osv):
|
|||
if week_days.has_key(week['dayofweek']):
|
||||
day = week_days[week['dayofweek']]
|
||||
wk_days[week['dayofweek']] = week_days[week['dayofweek']]
|
||||
hour_from_str = convert_timeformat(cr, uid, week['hour_from'])
|
||||
hour_to_str = convert_timeformat(cr, uid, week['hour_to'])
|
||||
hour_from_str = convert_timeformat(week['hour_from'])
|
||||
hour_to_str = convert_timeformat(week['hour_to'])
|
||||
res_str = hour_from_str + '-' + hour_to_str
|
||||
wktime_list.append((day, res_str))
|
||||
# Convert into format like [('mon', '8:00-12:00', '13:00-18:00')]
|
||||
|
|
Loading…
Reference in New Issue