res[project.id]['hrs_to_invoice'] = hrs_to_invoice
return res
+
+ def _compute_timesheet(self, cr, uid, ids, field_name, arg, context=None):
+ res={}
+ aal_pool=self.pool.get('account.analytic.line')
+ for project in self.browse(cr, uid, ids, context=context):
+ timesheet = aal_pool.search(cr, uid, [("account_id","=", project.analytic_account_id.id)])
+ res[project.id] = len(timesheet)
+ return res
_columns = {
'timesheets' : fields.boolean('Timesheets',help = "If you check this field timesheets appears in kanban view"),
'amt_to_invoice': fields.function(_to_invoice,string="Amount to Invoice",multi="sums"),
- 'hrs_to_invoice': fields.function(_to_invoice,string="Hours to Invoice",multi="sums")
+ 'hrs_to_invoice': fields.function(_to_invoice,string="Hours to Invoice",multi="sums"),
+ 'total_timesheet': fields.function(_compute_timesheet , type='integer',string="Issue"),
}
_defaults = {
'timesheets' : True,
<xpath expr="//h4[@id='list']" position="inside">
<a>
<t t-if="record.timesheets.raw_value">
- <button name="open_timesheets" class="oe_project_buttons" type="object">, Timesheet</button>
+ <button name="open_timesheets" class="oe_project_buttons" type="object">,<field name="total_timesheet"/> Timesheet</button>
</t>
</a>
</xpath>