[IMP]: Change data type integer to float in function field which calculate date diff in crm and project issue module.

bzr revid: rch_open_erp-20100422064017-8dl3jiwwmjca90bh
This commit is contained in:
rch (Open ERP) 2010-04-22 12:10:17 +05:30
parent 8d24e5db50
commit 1b92fca997
3 changed files with 24 additions and 24 deletions

View File

@ -55,9 +55,9 @@ class crm_lead(osv.osv):
@param ids: List of Opendays IDs
@return: difference between current date and log date
@param context: A standard dictionary for contextual values
"""
cal_obj = self.pool.get('resource.calendar')
res_obj = self.pool.get('resource.resource')
"""
cal_obj = self.pool.get('resource.calendar')
res_obj = self.pool.get('resource.resource')
res = {}
for lead in self.browse(cr, uid, ids , context):
@ -85,7 +85,7 @@ class crm_lead(osv.osv):
duration = float(ans.days)
if lead.section_id.resource_calendar_id:
duration = float(ans.days) * 24
duration = float(ans.days) * 24
new_dates = cal_obj.interval_get(cr,
uid,
lead.section_id.resource_calendar_id and lead.section_id.resource_calendar_id.id or False,
@ -97,9 +97,9 @@ class crm_lead(osv.osv):
date_until = mx.DateTime.strptime(date_until, '%Y-%m-%d %H:%M:%S')
for in_time, out_time in new_dates:
if in_time.date not in no_days:
no_days.append(in_time.date)
no_days.append(in_time.date)
if out_time > date_until:
break
break
duration = len(no_days)
res[lead.id][field] = abs(int(duration))
return res
@ -125,9 +125,9 @@ class crm_lead(osv.osv):
'referred': fields.char('Referred By', size=32),
'date_open': fields.datetime('Opened', readonly=True),
'day_open': fields.function(_compute_day, string='Days to Open', \
method=True, multi='day_open', type="integer", store=True),
method=True, multi='day_open', type="float", store=True),
'day_close': fields.function(_compute_day, string='Days to Close', \
method=True, multi='day_close', type="integer", store=True),
method=True, multi='day_close', type="float", store=True),
'function_name': fields.char('Function', size=64),
}

View File

@ -62,9 +62,9 @@ class crm_opportunity(osv.osv):
@param ids: List of Opendays IDs
@return: difference between current date and log date
@param context: A standard dictionary for contextual values
"""
cal_obj = self.pool.get('resource.calendar')
res_obj = self.pool.get('resource.resource')
"""
cal_obj = self.pool.get('resource.calendar')
res_obj = self.pool.get('resource.resource')
res = {}
for opportunity in self.browse(cr, uid, ids , context):
@ -92,7 +92,7 @@ class crm_opportunity(osv.osv):
duration = float(ans.days)
if opportunity.section_id.resource_calendar_id:
duration = float(ans.days) * 24
duration = float(ans.days) * 24
new_dates = cal_obj.interval_get(cr,
uid,
opportunity.section_id.resource_calendar_id and opportunity.section_id.resource_calendar_id.id or False,
@ -104,9 +104,9 @@ class crm_opportunity(osv.osv):
date_until = mx.DateTime.strptime(date_until, '%Y-%m-%d %H:%M:%S')
for in_time, out_time in new_dates:
if in_time.date not in no_days:
no_days.append(in_time.date)
no_days.append(in_time.date)
if out_time > date_until:
break
break
duration = len(no_days)
res[opportunity.id][field] = abs(int(duration))
return res
@ -137,9 +137,9 @@ class crm_opportunity(osv.osv):
'date_open': fields.datetime('Opened', readonly=True),
'day_open': fields.function(_compute_day, string='Days to Open', \
method=True, multi='day_open', type="integer", store=True),
method=True, multi='day_open', type="float", store=True),
'day_close': fields.function(_compute_day, string='Days to Close', \
method=True, multi='day_close', type="integer", store=True),
method=True, multi='day_close', type="float", store=True),
}
def onchange_stage_id(self, cr, uid, ids, stage_id, context={}):

View File

@ -58,9 +58,9 @@ class project_issue(osv.osv):
@param ids: List of Opendays IDs
@return: difference between current date and log date
@param context: A standard dictionary for contextual values
"""
cal_obj = self.pool.get('resource.calendar')
res_obj = self.pool.get('resource.resource')
"""
cal_obj = self.pool.get('resource.calendar')
res_obj = self.pool.get('resource.resource')
res = {}
for issue in self.browse(cr, uid, ids , context):
@ -88,7 +88,7 @@ class project_issue(osv.osv):
duration = float(ans.days)
if issue.section_id.resource_calendar_id:
duration = float(ans.days) * 24
duration = float(ans.days) * 24
new_dates = cal_obj.interval_get(cr,
uid,
issue.section_id.resource_calendar_id and issue.section_id.resource_calendar_id.id or False,
@ -100,9 +100,9 @@ class project_issue(osv.osv):
date_until = mx.DateTime.strptime(date_until, '%Y-%m-%d %H:%M:%S')
for in_time, out_time in new_dates:
if in_time.date not in no_days:
no_days.append(in_time.date)
no_days.append(in_time.date)
if out_time > date_until:
break
break
duration = len(no_days)
res[issue.id][field] = abs(int(duration))
return res
@ -124,9 +124,9 @@ class project_issue(osv.osv):
'task_id': fields.many2one('project.task', 'Task', domain="[('project_id','=',project_id)]"),
'date_open': fields.datetime('Opened', readonly=True),
'day_open': fields.function(_compute_day, string='Days to Open', \
method=True, multi='day_open', type="integer", store=True),
method=True, multi='day_open', type="float", store=True),
'day_close': fields.function(_compute_day, string='Days to Close', \
method=True, multi='day_close', type="integer", store=True),
method=True, multi='day_close', type="float", store=True),
'assigned_to' : fields.many2one('res.users', 'Assigned to'),
'timesheet_ids' : fields.one2many('hr.analytic.timesheet', 'issue_id', 'Timesheets'),
'analytic_account_id' : fields.many2one('account.analytic.account', 'Analytic Account',