bzr revid: sgo@tinyerp.com-20120404061617-r463yhakhd49ren7
This commit is contained in:
Sanjay Gohel (Open ERP) 2012-04-04 11:46:17 +05:30
parent e21bf1fd86
commit 66daeff774
2 changed files with 11 additions and 2 deletions

View File

@ -47,11 +47,20 @@ class project_project(osv.osv):
res[project.id]['hrs_to_invoice'] = hrs_to_invoice res[project.id]['hrs_to_invoice'] = hrs_to_invoice
return res 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 = { _columns = {
'timesheets' : fields.boolean('Timesheets',help = "If you check this field timesheets appears in kanban view"), '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"), '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 = { _defaults = {
'timesheets' : True, 'timesheets' : True,

View File

@ -38,7 +38,7 @@
<xpath expr="//h4[@id='list']" position="inside"> <xpath expr="//h4[@id='list']" position="inside">
<a> <a>
<t t-if="record.timesheets.raw_value"> <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> </t>
</a> </a>
</xpath> </xpath>