The community will be in read-only from Tuesday 11:59pm (PST) to Wednesday 7:30am (PST)
The community will be in read-only from Tuesday 11:59pm (PST) to Wednesday 7:30am (PST)
Project and Portfolio Management Practitioners Forum
cancel
Showing results for 
Search instead for 
Did you mean: 

Total time error while updating timesheet via python

Highlighted
Yevgeniy Demche
Super Collector

Total time error while updating timesheet via python

Hello, I'm using python to update timesheets (same troubles accures even when using Java):

ts_locator = TimeService_client.TimeServiceLocator()
ts_port = ts_locator.getTimeServiceSOAP11port()
ts_port.binding.SetAuth(AUTH.httpbasic,'user','pass')

# get existing timesheet
ts_get = TimeService_client.getTimeSheetMessage()
ts_get.set_element_timeSheetId(31751)
timesheet = ts_port.getTimeSheet(ts_get)

ts_update = TimeService_client.updateTimeSheetMessage()

# create new timesheetline
ts_u_bean = ts_update.new_timeSheetBean()
new_ts_line = ts_u_bean.new_timeSheetLines()
new_ts_line.set_element_workItemId(166088)
new_ts_line.set_element_workItemSetId(30543)
new_ts_line.set_element_workItemType('TASK')

# set up efforts
new_ts_al = new_ts_line.new_timeActualsList()
new_ts_al.set_element_totalsFlag(False)
new_ts_al.set_element_effortsList([0,0,0,0,0,0,0])
new_ts_line.set_element_timeActualsList([new_ts_al])

# get current timesheet lines
ts_lines = ts_bean.get_element_timeSheetLines()
# append created line
ts_lines.append(new_ts_line)

# update timesheet data in ppm
ts_bean.set_element_timeSheetLines(ts_lines)
ts_update.set_element_timeSheetBean(ts_bean)
ts_port.updateTimeSheet(ts_update)

everything updated well, BUT total time for tasks is increased, and we get 200, 400 even 960 hours for one task for one week.

What is wrong with the code?
2 REPLIES
Rafał Maliszews
Occasional Contributor

Re: Total time error while updating timesheet via python


btw:
Is You call yours python client to ppm or ppm has build in python module ?

regards
Yevgeniy Demche
Super Collector

Re: Total time error while updating timesheet via python

ppm has a soap service, so you can use what you want. This error appears even when using java program from ppm examples. So I think it is about some param or method, which I missed and which is undocumented. Still need help!
//Add this to "OnDomLoad" event