[IMP] project_issue: adding new field inactivity_days, that can be used in tree view to color late things on which action is needed

bzr revid: qdp-launchpad@openerp.com-20110809103736-yd4hokhciyy681pl
This commit is contained in:
Quentin (OpenERP) 2011-08-09 12:37:36 +02:00
commit 13ecd980b7
2 changed files with 10 additions and 0 deletions

View File

@ -116,6 +116,12 @@ class project_issue(crm.crm_case, osv.osv):
hours = cal_obj.interval_hours_get(cr, uid, issue.project_id.resource_calendar_id.id,
datetime.strptime(issue.create_date, '%Y-%m-%d %H:%M:%S'),
datetime.strptime(issue.date_closed, '%Y-%m-%d %H:%M:%S'))
elif field in ['inactivity_days']:
res[issue.id][field] = 0
if issue.date_action_last:
inactive_days = datetime.today() - datetime.strptime(issue.date_action_last, '%Y-%m-%d %H:%M:%S')
res[issue.id][field] = inactive_days.days
continue
if ans:
resource_id = False
if issue.user_id:
@ -213,6 +219,8 @@ class project_issue(crm.crm_case, osv.osv):
multi='compute_day', type="float", store=True),
'working_hours_close': fields.function(_compute_day, string='Working Hours to Close the Issue', \
multi='compute_day', type="float", store=True),
'inactivity_days': fields.function(_compute_day, string='Days since last action', \
multi='compute_day', type="integer", help="Difference in days between last action and current date"),
'message_ids': fields.one2many('mailgate.message', 'res_id', 'Messages', domain=[('model','=',_name)]),
'date_action_last': fields.datetime('Last Action', readonly=1),
'date_action_next': fields.datetime('Next Action', readonly=1),

View File

@ -153,6 +153,7 @@
<field name="write_date" />
<field name="date_closed"/>
<field name="date_open"/>
<field name="last_action_date"/>
</group>
<group colspan="2" col="2">
<separator string="Statistics" colspan="2" col="2"/>
@ -160,6 +161,7 @@
<field name="day_close"/>
<field name="working_hours_open" widget="float_time"/>
<field name="working_hours_close" widget="float_time"/>
<field name="inactivity_days"/>
</group>
<group colspan="2" col="2">
<separator string="References" colspan="2"/>