From fc2dd8983d63ea4eb54fc217ff136dcd9c4d6aa7 Mon Sep 17 00:00:00 2001 From: Simon Lejeune Date: Wed, 23 Apr 2014 11:54:09 +0200 Subject: [PATCH] [WIP] hr_attendance graphview: moved graph declaration inside hr_attendance_view.xml, removed the useless day field on hr.attendance model, fixed the groupby so that se graphview allows to group by day, week, etc. bzr revid: sle@openerp.com-20140423095409-wab11nwouwnz43og --- addons/hr_attendance/__openerp__.py | 1 - .../data/attendance_graphview.xml | 33 ------------------- addons/hr_attendance/hr_attendance.py | 8 ----- addons/hr_attendance/hr_attendance_view.xml | 31 +++++++++++++++-- 4 files changed, 29 insertions(+), 44 deletions(-) delete mode 100644 addons/hr_attendance/data/attendance_graphview.xml diff --git a/addons/hr_attendance/__openerp__.py b/addons/hr_attendance/__openerp__.py index 447e1b08b8e..abdc1ad8cc1 100644 --- a/addons/hr_attendance/__openerp__.py +++ b/addons/hr_attendance/__openerp__.py @@ -44,7 +44,6 @@ actions(Sign in/Sign out) performed by them. 'wizard/hr_attendance_error_view.xml', 'res_config_view.xml', 'views/report_attendanceerrors.xml', - 'data/attendance_graphview.xml', ], 'demo': ['hr_attendance_demo.xml'], 'test': [ diff --git a/addons/hr_attendance/data/attendance_graphview.xml b/addons/hr_attendance/data/attendance_graphview.xml deleted file mode 100644 index 4a4ec02359c..00000000000 --- a/addons/hr_attendance/data/attendance_graphview.xml +++ /dev/null @@ -1,33 +0,0 @@ - - - - - hr.attendance.graph - hr.attendance - - - - - - - - - - - - Attendance - hr.attendance - form - graph - - - - - - - \ No newline at end of file diff --git a/addons/hr_attendance/hr_attendance.py b/addons/hr_attendance/hr_attendance.py index b31a0c91b91..7df5bb34c68 100644 --- a/addons/hr_attendance/hr_attendance.py +++ b/addons/hr_attendance/hr_attendance.py @@ -21,7 +21,6 @@ import time from datetime import datetime -import math from openerp.osv import fields, osv from openerp.tools.translate import _ @@ -46,12 +45,6 @@ class hr_attendance(osv.osv): _name = "hr.attendance" _description = "Attendance" - def _day_compute(self, cr, uid, ids, fieldnames, args, context=None): - res = dict.fromkeys(ids, '') - for obj in self.browse(cr, uid, ids, context=context): - res[obj.id] = time.strftime('%Y-%m-%d', time.strptime(obj.name, '%Y-%m-%d %H:%M:%S')) - return res - def _worked_hours_compute(self, cr, uid, ids, fieldnames, args, context=None): """For each hr.attendance record of action sign-in: assign 0. For each hr.attendance record of action sign-out: assign number of hours since last sign-in. @@ -80,7 +73,6 @@ class hr_attendance(osv.osv): 'action': fields.selection([('sign_in', 'Sign In'), ('sign_out', 'Sign Out'), ('action','Action')], 'Action', required=True), 'action_desc': fields.many2one("hr.action.reason", "Action Reason", domain="[('action_type', '=', action)]", help='Specifies the reason for Signing In/Signing Out in case of extra hours.'), 'employee_id': fields.many2one('hr.employee', "Employee", required=True, select=True), - 'day': fields.function(_day_compute, type='char', string='Day', store=True, select=1, size=32), 'worked_hours': fields.function(_worked_hours_compute, type='float', string='Worked Hours', store=True), } _defaults = { diff --git a/addons/hr_attendance/hr_attendance_view.xml b/addons/hr_attendance/hr_attendance_view.xml index c38ee45b510..c2fdd0b0ae9 100644 --- a/addons/hr_attendance/hr_attendance_view.xml +++ b/addons/hr_attendance/hr_attendance_view.xml @@ -40,7 +40,6 @@ - @@ -53,17 +52,30 @@ + - + + + hr.attendance.graph + hr.attendance + + + + + + + + + Attendances hr.attendance @@ -74,12 +86,27 @@ The Time Tracking functionality aims to manage employee attendances from Sign in/Sign out actions. You can also link this feature to an attendance device using OpenERP's web service features. + + Attendance + hr.attendance + form + graph + + + + + hr.action.reason.form hr.action.reason