From 66daeff7746180dce5f38d1defcc24e3b381879a Mon Sep 17 00:00:00 2001 From: "Sanjay Gohel (Open ERP)" Date: Wed, 4 Apr 2012 11:46:17 +0530 Subject: [PATCH] [IMP] bzr revid: sgo@tinyerp.com-20120404061617-r463yhakhd49ren7 --- addons/project_timesheet/project_timesheet.py | 11 ++++++++++- addons/project_timesheet/project_timesheet_view.xml | 2 +- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/addons/project_timesheet/project_timesheet.py b/addons/project_timesheet/project_timesheet.py index 5e5285b1816..85231fe6f2c 100644 --- a/addons/project_timesheet/project_timesheet.py +++ b/addons/project_timesheet/project_timesheet.py @@ -47,11 +47,20 @@ class project_project(osv.osv): 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, diff --git a/addons/project_timesheet/project_timesheet_view.xml b/addons/project_timesheet/project_timesheet_view.xml index 6fbec2d84f2..efe8edb9808 100644 --- a/addons/project_timesheet/project_timesheet_view.xml +++ b/addons/project_timesheet/project_timesheet_view.xml @@ -38,7 +38,7 @@ - +