From e7e8243d9d173a7103f31c44915b4bd702a4e068 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Thu, 11 Mar 2010 16:55:07 +0100 Subject: [PATCH] New interface for Function/Property fields --- work.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/work.py b/work.py index b8f209a365..c29693ff5e 100644 --- a/work.py +++ b/work.py @@ -18,8 +18,8 @@ class Work(ModelSQL, ModelView): left = fields.Integer('Left', required=True, select=1) right = fields.Integer('Right', required=True, select=1) children = fields.One2Many('timesheet.work', 'parent', 'Children') - hours = fields.Function('get_hours', digits=(16, 2), - string='Timesheet Hours', help="Total time spent on this work") + hours = fields.Function(fields.Float('Timesheet Hours', digits=(16, 2), + help="Total time spent on this work"), 'get_hours') timesheet_available = fields.Boolean('Available on timesheets', help="Allow to fill in timesheets with this work") company = fields.Many2One('company.company', 'Company', required=True) @@ -71,7 +71,7 @@ class Work(ModelSQL, ModelView): to_compute[h] = False return res - def get_hours(self, cursor, user, ids, name, arg, context=None): + def get_hours(self, cursor, user, ids, name, context=None): all_ids = self.search(cursor, user, [ ('parent', 'child_of', ids) ], context=context) @@ -102,7 +102,7 @@ class Work(ModelSQL, ModelView): self._tree_qty(hours_by_wt, children, ids, to_compute) return hours_by_wt - def get_rec_name(self, cursor, user, ids, name, arg, context=None): + def get_rec_name(self, cursor, user, ids, name, context=None): if not ids: return {} res = {}