[IMP]improve progress as per suggestion

bzr revid: sgo@tinyerp.com-20120411120329-as07fv3jd2hoeqxa
This commit is contained in:
Sanjay Gohel (Open ERP) 2012-04-11 17:33:29 +05:30
parent e6648c61b0
commit 490cc4a0cf
2 changed files with 11 additions and 2 deletions

View File

@ -162,6 +162,13 @@ class project(osv.osv):
task_ids = task_pool.search(cr, uid, [('project_id', '=', id)])
open_task[id] = len(task_ids)
return open_task
def _cal_days(self, cr, uid, ids, field_name, arg, context=None):
cal_days = {}
for project in self.browse(cr,uid,ids):
cal_days[project.id] = project.company_id.project_time_mode_id.factor or 8
return cal_days
_columns = {
'complete_name': fields.function(_complete_name, string="Project Name", type='char', size=250),
@ -202,6 +209,7 @@ class project(osv.osv):
'task': fields.boolean('Task',help = "If you check this field tasks appears in kanban view"),
'open_task': fields.function(_open_task , type='integer',string="Open Tasks"),
'color': fields.integer('Color Index'),
'cal_days': fields.function(_cal_days ,type="integer", string="Calculate Days"),
}
def dummy(self, cr, uid, ids, context=None):
return False

View File

@ -167,7 +167,7 @@
<field name="arch" type="xml">
<kanban>
<field name="effective_hours"/>
<field name="total_hours"/>
<field name="planned_hours"/>
<field name="date"/>
<field name="name"/>
<field name="members"/>
@ -175,6 +175,7 @@
<field name="user_id"/>
<field name="date"/>
<field name="color"/>
<field name="cal_days"/>
<field name="open_task"/>
<templates>
<t t-name="kanban-box">
@ -216,7 +217,7 @@
<tr>
<th align="left" width="70px">Progress</th>
<td align="left">
<t t-esc="Math.round(record.effective_hours.raw_value/24)"/>/<t t-esc="Math.round(record.total_hours.raw_value/24)"/> days
<t t-esc="Math.round(record.effective_hours.raw_value/record.cal_days.value)"/>/<t t-esc="Math.round(record.planned_hours.raw_value/record.cal_days.value)"/> days
</td>
</tr>
</table>