diff options
| author | Harshad Modi <hmo@tinyerp.com> | 2008-09-18 21:12:10 +0530 |
|---|---|---|
| committer | Harshad Modi <hmo@tinyerp.com> | 2008-09-18 21:12:10 +0530 |
| commit | 9b7fb1feb0b0faa1bc5a8e8bf26a0e2a63651396 (patch) | |
| tree | 3d66db663c5db673abda8458aea8cbd0eb4b255c | |
| parent | ba2373da640562c5384ffe767bede1c2869ffed9 (diff) | |
| parent | 7c56005927d4b6471a6e2895b1b0ee90a6510888 (diff) | |
merge pso branch
bzr revid: hmo@tinyerp.com-20080918154210-24ewi2d25azyom9i
27 files changed, 1065 insertions, 671 deletions
diff --git a/addons/hr/__terp__.py b/addons/hr/__terp__.py index e30166aebda..fb8873e5fc7 100644 --- a/addons/hr/__terp__.py +++ b/addons/hr/__terp__.py @@ -47,10 +47,9 @@ "hr_department_demo.xml", ], "update_xml" : [ - "security/hr_security.xml", - "security/ir.model.access.csv", +# "security/hr_security.xml", +# "security/ir.model.access.csv", "hr_view.xml", - "hr_report.xml", "hr_wizard.xml", "hr_department_view.xml", ], diff --git a/addons/hr/hr.py b/addons/hr/hr.py index ab75529d4b8..5926e64eae4 100644 --- a/addons/hr/hr.py +++ b/addons/hr/hr.py @@ -97,26 +97,6 @@ class hr_employee(osv.osv): _name = "hr.employee" _description = "Employee" - def _state(self, cr, uid, ids, name, args, context={}): - result = {} - for id in ids: - result[id] = 'absent' - cr.execute('SELECT hr_attendance.action, hr_attendance.employee_id \ - FROM ( \ - SELECT MAX(name) AS name, employee_id \ - FROM hr_attendance \ - WHERE action in (\'sign_in\', \'sign_out\') \ - GROUP BY employee_id \ - ) AS foo \ - LEFT JOIN hr_attendance \ - ON (hr_attendance.employee_id = foo.employee_id \ - AND hr_attendance.name = foo.name) \ - WHERE hr_attendance.employee_id \ - in (' + ','.join([str(x) for x in ids]) + ')') - for res in cr.fetchall(): - result[res[1]] = res[0] == 'sign_in' and 'present' or 'absent' - return result - _columns = { 'name' : fields.char("Employee", size=128, required=True), 'active' : fields.boolean('Active'), @@ -137,55 +117,14 @@ class hr_employee(osv.osv): 'work_location': fields.char('Office Location', size=32), 'notes': fields.text('Notes'), - 'state': fields.function(_state, method=True, type='selection', selection=[('absent', 'Absent'), ('present', 'Present')], string='Attendance'), - 'parent_id': fields.many2one('hr.employee', 'Manager', select=True), 'category_id' : fields.many2one('hr.employee.category', 'Category'), - 'child_ids': fields.one2many('hr.employee', 'parent_id','Subordinates'), } _defaults = { 'active' : lambda *a: True, - 'state' : lambda *a: 'absent', } - def sign_change(self, cr, uid, ids, context={}, dt=False): - for emp in self.browse(cr, uid, ids): - if not self._action_check(cr, uid, emp.id, dt, context): - raise osv.except_osv(_('Warning'), _('You tried to sign with a date anterior to another event !\nTry to contact the administrator to correct attendances.')) - res = {'action':'action', 'employee_id':emp.id} - if dt: - res['name'] = dt - att_id = self.pool.get('hr.attendance').create(cr, uid, res, context=context) - return True - - def sign_out(self, cr, uid, ids, context={}, dt=False, *args): - id = False - for emp in self.browse(cr, uid, ids): - if not self._action_check(cr, uid, emp.id, dt, context): - raise osv.except_osv(_('Warning'), _('You tried to sign out with a date anterior to another event !\nTry to contact the administrator to correct attendances.')) - res = {'action':'sign_out', 'employee_id':emp.id} - if dt: - res['name'] = dt - att_id = self.pool.get('hr.attendance').create(cr, uid, res, context=context) - id = att_id - return id - - def _action_check(self, cr, uid, emp_id, dt=False,context={}): - cr.execute('select max(name) from hr_attendance where employee_id=%d', (emp_id,)) - res = cr.fetchone() - return not (res and (res[0]>=(dt or time.strftime('%Y-%m-%d %H:%M:%S')))) - - def sign_in(self, cr, uid, ids, context={}, dt=False, *args): - id = False - for emp in self.browse(cr, uid, ids): - if not self._action_check(cr, uid, emp.id, dt, context): - raise osv.except_osv(_('Warning'), _('You tried to sign in with a date anterior to another event !\nTry to contact the administrator to correct attendances.')) - res = {'action':'sign_in', 'employee_id':emp.id} - if dt: - res['name'] = dt - id = self.pool.get('hr.attendance').create(cr, uid, res, context=context) - return id - + hr_employee() class hr_timesheet(osv.osv): @@ -202,56 +141,4 @@ class hr_timesheet(osv.osv): _order = 'dayofweek, hour_from' hr_timesheet() -class hr_action_reason(osv.osv): - _name = "hr.action.reason" - _description = "Action reason" - _columns = { - 'name' : fields.char('Reason', size=64, required=True), - 'action_type' : fields.selection([('sign_in', 'Sign in'), ('sign_out', 'Sign out')], "Action's type"), - } - _defaults = { - 'action_type' : lambda *a: 'sign_in', - } -hr_action_reason() - -def _employee_get(obj,cr,uid,context={}): - ids = obj.pool.get('hr.employee').search(cr, uid, [('user_id','=', uid)]) - if ids: - return ids[0] - return False - -class hr_attendance(osv.osv): - _name = "hr.attendance" - _description = "Attendance" - _columns = { - 'name' : fields.datetime('Date', required=True), - '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)]"), - 'employee_id' : fields.many2one('hr.employee', 'Employee', required=True, select=True), - } - _defaults = { - 'name' : lambda *a: time.strftime('%Y-%m-%d %H:%M:%S'), - 'employee_id' : _employee_get, - } - - def _altern_si_so(self, cr, uid, ids): - for id in ids: - sql = ''' - select action, name - from hr_attendance as att - where employee_id = (select employee_id from hr_attendance where id=%s) - and action in ('sign_in','sign_out') - and name <= (select name from hr_attendance where id=%s) - order by name desc - limit 2 - ''' % (id, id) - cr.execute(sql) - atts = cr.fetchall() - if not ((len(atts)==1 and atts[0][0] == 'sign_in') or (atts[0][0] != atts[1][0] and atts[0][1] != atts[1][1])): - return False - return True - - _constraints = [(_altern_si_so, 'Error: Sign in (resp. Sign out) must follow Sign out (resp. Sign in)', ['action'])] - _order = 'name desc' -hr_attendance() diff --git a/addons/hr/hr_demo.xml b/addons/hr/hr_demo.xml index c83c20d5a9b..9465e57ab14 100644 --- a/addons/hr/hr_demo.xml +++ b/addons/hr/hr_demo.xml @@ -2,31 +2,6 @@ <openerp> <data> - <record model="hr.action.reason"> - <field name="name">Start of shift</field> - <field name="action_type">sign_in</field> - </record> - <record model="hr.action.reason"> - <field name="name">End of shift</field> - <field name="action_type">sign_out</field> - </record> - <record model="hr.action.reason"> - <field name="name">Meal Break</field> - <field name="action_type">sign_in</field> - </record> - <record model="hr.action.reason"> - <field name="name">Meal Break</field> - <field name="action_type">sign_out</field> - </record> - <record model="hr.action.reason"> - <field name="name">Early exit (sick)</field> - <field name="action_type">sign_out</field> - </record> - <record model="hr.action.reason"> - <field name="name">Early exit (work injury)</field> - <field name="action_type">sign_out</field> - </record> - <!-- Example employee --> <record id="timesheet_group1" model="hr.timesheet.group"> @@ -111,105 +86,5 @@ <field name="tgroup_id" ref="timesheet_group1"/> </record> - <record id="attendance1" model="hr.attendance"> - <field eval="time.strftime('%Y-%m-01 08:21')" name="name"/> - <field name="action">sign_in</field> - <field name="employee_id" ref="employee1"/> - </record> - <record id="attendance2" model="hr.attendance"> - <field eval="time.strftime('%Y-%m-01 11:51')" name="name"/> - <field name="action">sign_out</field> - <field name="employee_id" ref="employee1"/> - </record> - <record id="attendance3" model="hr.attendance"> - <field eval="time.strftime('%Y-%m-02 12:47')" name="name"/> - <field name="action">sign_in</field> - <field name="employee_id" ref="employee1"/> - </record> - <record id="attendance4" model="hr.attendance"> - <field eval="time.strftime('%Y-%m-02 19:53')" name="name"/> - <field name="action">sign_out</field> - <field name="employee_id" ref="employee1"/> - </record> - <record id="attendance5" model="hr.attendance"> - <field eval="time.strftime('%Y-%m-03 07:32')" name="name"/> - <field name="action">sign_in</field> - <field name="employee_id" ref="employee1"/> - </record> - <record id="attendance6" model="hr.attendance"> - <field eval="time.strftime('%Y-%m-03 12:32')" name="name"/> - <field name="action">sign_out</field> - <field name="employee_id" ref="employee1"/> - </record> - <record id="attendance7" model="hr.attendance"> - <field eval="time.strftime('%Y-%m-04 14:01')" name="name"/> - <field name="action">sign_in</field> - <field name="employee_id" ref="employee1"/> - </record> - <record id="attendance8" model="hr.attendance"> - <field eval="time.strftime('%Y-%m-04 17:21')" name="name"/> - <field name="action">sign_out</field> - <field name="employee_id" ref="employee1"/> - </record> - <record id="attendance9" model="hr.attendance"> - <field eval="time.strftime('%Y-%m-05 09:10')" name="name"/> - <field name="action">sign_in</field> - <field name="employee_id" ref="employee1"/> - </record> - <record id="attendance10" model="hr.attendance"> - <field eval="time.strftime('%Y-%m-05 12:42')" name="name"/> - <field name="action">sign_out</field> - <field name="employee_id" ref="employee1"/> - </record> - <record id="attendance11" model="hr.attendance"> - <field eval="time.strftime('%Y-%m-06 13:10')" name="name"/> - <field name="action">sign_in</field> - <field name="employee_id" ref="employee1"/> - </record> - <record id="attendance12" model="hr.attendance"> - <field eval="time.strftime('%Y-%m-06 18:34')" name="name"/> - <field name="action">sign_out</field> - <field name="employee_id" ref="employee1"/> - </record> - <record id="attendance13" model="hr.attendance"> - <field eval="time.strftime('%Y-%m-07 08:21')" name="name"/> - <field name="action">sign_in</field> - <field name="employee_id" ref="employee1"/> - </record> - <record id="attendance14" model="hr.attendance"> - <field eval="time.strftime('%Y-%m-07 18:21')" name="name"/> - <field name="action">sign_out</field> - <field name="employee_id" ref="employee1"/> - </record> - <record id="attendance15" model="hr.attendance"> - <field eval="time.strftime('%Y-%m-08 08:21')" name="name"/> - <field name="action">sign_in</field> - <field name="employee_id" ref="employee1"/> - </record> - <record id="attendance16" model="hr.attendance"> - <field eval="time.strftime('%Y-%m-08 12:54')" name="name"/> - <field name="action">sign_out</field> - <field name="employee_id" ref="employee1"/> - </record> - <record id="attendance17" model="hr.attendance"> - <field eval="time.strftime('%Y-%m-09 13:32')" name="name"/> - <field name="action">sign_in</field> - <field name="employee_id" ref="employee1"/> - </record> - <record id="attendance18" model="hr.attendance"> - <field eval="time.strftime('%Y-%m-09 19:31')" name="name"/> - <field name="action">sign_out</field> - <field name="employee_id" ref="employee1"/> - </record> - <record id="attendance19" model="hr.attendance"> - <field eval="time.strftime('%Y-%m-10 07:10')" name="name"/> - <field name="action">sign_in</field> - <field name="employee_id" ref="employee1"/> - </record> - <record id="attendance20" model="hr.attendance"> - <field eval="time.strftime('%Y-%m-10 12:34')" name="name"/> - <field name="action">sign_out</field> - <field name="employee_id" ref="employee1"/> - </record> </data> </openerp> diff --git a/addons/hr/hr_view.xml b/addons/hr/hr_view.xml index 879f4328db6..5b58d7cf448 100644 --- a/addons/hr/hr_view.xml +++ b/addons/hr/hr_view.xml @@ -49,9 +49,7 @@ <group col="4" colspan="2"> <separator string="Job Information" colspan="4"/> <field name="parent_id" select="1" colspan="4"/> - <field name="state"/> - <button name="sign_in" states="absent" string="Sign In" type="object"/> - <button name="sign_out" states="present" string="Sign Out" type="object"/> + <field name="category_id" colspan="4"/> </group> </page> @@ -75,7 +73,6 @@ <field name="work_email"/> <field name="address_id"/> <field name="parent_id"/> - <field name="state"/> </tree> </field> </record> @@ -142,7 +139,7 @@ <field name="name"/> <field name="user_id"/> <field name="address_id"/> - <field name="state"/> + </tree> </field> </record> @@ -219,34 +216,13 @@ </field> </record> - <!-- Attendance --> - <record id="view_attendance_form" model="ir.ui.view"> - <field name="name">hr.attendance.form</field> - <field name="model">hr.attendance</field> - <field name="type">form</field> - <field name="arch" type="xml"> - <form string="Employee attendance"> - <field name="employee_id" select="1"/> - <field colspan="4" name="name" select="1"/> - <field name="action" select="1"/> - <field name="action_desc" select="1"/> - </form> - </field> - </record> - <record id="view_attendance_tree" model="ir.ui.view"> - <field name="name">hr.attendance.tree</field> - <field name="model">hr.attendance</field> - <field name="type">tree</field> - <field name="arch" type="xml"> - <tree string="Employee attendances"> - <field name="name"/> - <field name="action"/> - <field name="action_desc"/> - </tree> - </field> - </record> + <!-- + ============ + Employee Category + ============ + --> - <record id="view_employee_category_form" model="ir.ui.view"> + <record id="view_employee_category_form" model="ir.ui.view"> <field name="name">hr.employee.category.form</field> <field name="model">hr.employee.category</field> <field name="type">form</field> @@ -296,62 +272,6 @@ <field name="domain">[('parent_id','=',False)]</field> </record> <menuitem action="open_view_categ_tree" id="menu_view_employee_category_tree" parent="hr.menu_view_employee_category_form"/> - - <record id="view_attendance_who" model="ir.ui.view"> - <field name="name">hr.attendance.tree</field> - <field name="model">hr.attendance</field> - <field name="type">tree</field> - <field eval="3" name="priority"/> - <field name="arch" type="xml"> - <tree string="Employee attendance"> - <field name="employee_id"/> - <field name="name"/> - <field name="action"/> - <field name="action_desc"/> - </tree> - </field> - </record> - <record id="open_view_attendance" model="ir.actions.act_window"> - <field name="name">Attendances</field> - <field name="res_model">hr.attendance</field> - <field name="view_type">form</field> - <field name="view_mode">tree,form</field> - </record> - <menuitem id="menu_hr_attendance" name="Attendances" parent="hr.menu_hr_root"/> - <menuitem action="open_view_attendance" id="menu_open_view_attendance" parent="hr.menu_hr_attendance"/> - - - <record id="edit_attendance_reason" model="ir.ui.view"> - <field name="name">hr.action.reason.form</field> - <field name="model">hr.action.reason</field> - <field name="type">form</field> - <field name="arch" type="xml"> - <form string="Define attendance reason"> - <field colspan="4" name="name" select="1"/> - <field name="action_type" select="1"/> - </form> - </field> - </record> - <record id="view_attendance_reason" model="ir.ui.view"> - <field name="name">hr.action.reason.tree</field> - <field name="model">hr.action.reason</field> - <field name="type">tree</field> - <field name="arch" type="xml"> - <tree string="Attendance reasons"> - <field name="name"/> - <field name="action_type"/> - </tree> - </field> - </record> - <record id="open_view_attendance_reason" model="ir.actions.act_window"> - <field name="name">Attendance Reasons</field> - <field name="type">ir.actions.act_window</field> - <field name="res_model">hr.action.reason</field> - <field name="view_type">form</field> - <field name="view_mode">tree,form</field> - <field name="view_id" ref="view_attendance_reason"/> - </record> - <menuitem action="open_view_attendance_reason" id="menu_open_view_attendance_reason" parent="hr.menu_hr_configuration"/> - + </data> </openerp> diff --git a/addons/hr/hr_wizard.xml b/addons/hr/hr_wizard.xml index 71dcb201381..8b3c3e1c619 100644 --- a/addons/hr/hr_wizard.xml +++ b/addons/hr/hr_wizard.xml @@ -2,15 +2,12 @@ <openerp> <data> - <wizard id="si_so" model="hr.employee" name="hr.si_so" string="Sign in / Sign out"/> - - <menuitem action="si_so" id="menu_si_so" parent="hr.menu_hr_attendance" type="wizard"/> <!-- <wizard id="print_week" keyword="client_print_multi" model="hr.employee" name="hr.print_week" string="Print Timesheet by week"/> <wizard id="print_month" keyword="client_print_multi" model="hr.employee" name="hr.print_month" string="Print Timesheet by month"/> --> - <wizard id="wizard_attendance_error" keyword="client_print_multi" model="hr.employee" name="hr.timesheet.attendance.report" string="Print Attendance Error Report"/> + </data> </openerp> diff --git a/addons/hr/report/__init__.py b/addons/hr/report/__init__.py index b3d4f8263fe..0a96f7363f4 100644 --- a/addons/hr/report/__init__.py +++ b/addons/hr/report/__init__.py @@ -29,7 +29,6 @@ ############################################################################## import bymonth -import attendance_errors # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/hr/wizard/__init__.py b/addons/hr/wizard/__init__.py index dab91d43608..e898f4c6561 100644 --- a/addons/hr/wizard/__init__.py +++ b/addons/hr/wizard/__init__.py @@ -28,11 +28,11 @@ # ############################################################################## -from print_byweek import wiz_byweek -from print_bymonth import wiz_bymonth -import print_attendance_error +#from print_byweek import wiz_byweek +#from print_bymonth import wiz_bymonth + + -import sign_in_out # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/hr/wizard/print_attendance_error.py b/addons/hr_attendance/__init__.py index 83da09863ce..917959631a7 100644 --- a/addons/hr/wizard/print_attendance_error.py +++ b/addons/hr_attendance/__init__.py @@ -28,37 +28,8 @@ # ############################################################################## +import hr_attendance import wizard -import time - -_date_form = '''<?xml version="1.0"?> -<form string="Select a time span"> - <separator string="Analysis Information" colspan="4"/> - <field name="init_date"/> - <field name="end_date"/> - <field name="max_delay"/> - <label string="Bellow this delay, the error is considered as volunteer" colspan="2"/> -</form>''' - -_date_fields = { - 'init_date': {'string':'Starting Date', 'type':'date', 'default':lambda *a: time.strftime('%Y-%m-%d'), 'required':True}, - 'end_date': {'string':'Ending Date', 'type':'date', 'default':lambda *a: time.strftime('%Y-%m-%d'), 'required':True}, - 'max_delay': {'string':'Max. Delay (Min)', 'type':'integer', 'default':lambda *a: 120, 'required':True}, -} - -class wiz_attendance(wizard.interface): - states = { - 'init': { - 'actions': [], - 'result': {'type': 'form', 'arch':_date_form, 'fields':_date_fields, 'state':[('print','Print Attendance Report'),('end','Cancel') ]} - }, - 'print': { - 'actions': [], - 'result': {'type': 'print', 'report': 'hr.timesheet.attendance.error', 'state':'end'} - } - } -wiz_attendance('hr.timesheet.attendance.report') - +import report # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: - diff --git a/addons/hr_attendance/__terp__.py b/addons/hr_attendance/__terp__.py new file mode 100644 index 00000000000..0dd9eff1013 --- /dev/null +++ b/addons/hr_attendance/__terp__.py @@ -0,0 +1,16 @@ +{ + "name" : "Attendances Of Employees", + "version" : "1.0", + "author" : "Tiny", + "category" : "Generic Modules/Human Resources", + "description": "This module aims to manage employee's attendances.", + "depends" : ["base","hr",], + "demo_xml" : ["hr_attendance_demo.xml"], + "update_xml" : [ + "hr_attendance_view.xml", + "hr_attendance_wizard.xml", + "hr_attendance_report.xml" + ], + "active": False, + "installable": True, +} diff --git a/addons/hr_attendance/hr_attendance.py b/addons/hr_attendance/hr_attendance.py new file mode 100644 index 00000000000..7550ec18847 --- /dev/null +++ b/addons/hr_attendance/hr_attendance.py @@ -0,0 +1,158 @@ +# -*- encoding: utf-8 -*- +############################################################################## +# +# Copyright (c) 2004-2008 TINY SPRL. (http://tiny.be) All Rights Reserved. +# +# $Id$ +# +# WARNING: This program as such is intended to be used by professional +# programmers who take the whole responsability of assessing all potential +# consequences resulting from its eventual inadequacies and bugs +# End users who are looking for a ready-to-use solution with commercial +# garantees and support are strongly adviced to contract a Free Software +# Service Company +# +# This program is Free Software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +############################################################################## + +from mx import DateTime +import time + +from osv import fields, osv +from tools.translate import _ + +class hr_action_reason(osv.osv): + _name = "hr.action.reason" + _description = "Action reason" + _columns = { + 'name' : fields.char('Reason', size=64, required=True), + 'action_type' : fields.selection([('sign_in', 'Sign in'), ('sign_out', 'Sign out')], "Action's type"), + } + _defaults = { + 'action_type' : lambda *a: 'sign_in', + } +hr_action_reason() + +def _employee_get(obj,cr,uid,context={}): + ids = obj.pool.get('hr.employee').search(cr, uid, [('user_id','=', uid)]) + if ids: + return ids[0] + return False + +class hr_attendance(osv.osv): + _name = "hr.attendance" + _description = "Attendance" + _columns = { + 'name' : fields.datetime('Date', required=True), + '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)]"), + 'employee_id' : fields.many2one('hr.employee', 'Employee', required=True, select=True), + } + _defaults = { + 'name' : lambda *a: time.strftime('%Y-%m-%d %H:%M:%S'), + 'employee_id' : _employee_get, + } + + def _altern_si_so(self, cr, uid, ids): + for id in ids: + sql = ''' + select action, name + from hr_attendance as att + where employee_id = (select employee_id from hr_attendance where id=%s) + and action in ('sign_in','sign_out') + and name <= (select name from hr_attendance where id=%s) + order by name desc + limit 2 + ''' % (id, id) + cr.execute(sql) + atts = cr.fetchall() + if not ((len(atts)==1 and atts[0][0] == 'sign_in') or (atts[0][0] != atts[1][0] and atts[0][1] != atts[1][1])): + return False + return True + + _constraints = [(_altern_si_so, 'Error: Sign in (resp. Sign out) must follow Sign out (resp. Sign in)', ['action'])] + _order = 'name desc' +hr_attendance() + +class hr_employee(osv.osv): + _inherit = "hr.employee" + _description = "Employee" + + def _state(self, cr, uid, ids, name, args, context={}): + result = {} + for id in ids: + result[id] = 'absent' + cr.execute('SELECT hr_attendance.action, hr_attendance.employee_id \ + FROM ( \ + SELECT MAX(name) AS name, employee_id \ + FROM hr_attendance \ + WHERE action in (\'sign_in\', \'sign_out\') \ + GROUP BY employee_id \ + ) AS foo \ + LEFT JOIN hr_attendance \ + ON (hr_attendance.employee_id = foo.employee_id \ + AND hr_attendance.name = foo.name) \ + WHERE hr_attendance.employee_id \ + in (' + ','.join([str(x) for x in ids]) + ')') + for res in cr.fetchall(): + result[res[1]] = res[0] == 'sign_in' and 'present' or 'absent' + return result + + _columns = { + 'state': fields.function(_state, method=True, type='selection', selection=[('absent', 'Absent'), ('present', 'Present')], string='Attendance'), + } + + def sign_change(self, cr, uid, ids, context={}, dt=False): + for emp in self.browse(cr, uid, ids): + if not self._action_check(cr, uid, emp.id, dt, context): + raise osv.except_osv(_('Warning'), _('You tried to sign with a date anterior to another event !\nTry to contact the administrator to correct attendances.')) + res = {'action':'action', 'employee_id':emp.id} + if dt: + res['name'] = dt + att_id = self.pool.get('hr.attendance').create(cr, uid, res, context=context) + return True + + def sign_out(self, cr, uid, ids, context={}, dt=False, *args): + id = False + for emp in self.browse(cr, uid, ids): + if not self._action_check(cr, uid, emp.id, dt, context): + raise osv.except_osv(_('Warning'), _('You tried to sign out with a date anterior to another event !\nTry to contact the administrator to correct attendances.')) + res = {'action':'sign_out', 'employee_id':emp.id} + if dt: + res['name'] = dt + att_id = self.pool.get('hr.attendance').create(cr, uid, res, context=context) + id = att_id + return id + + def _action_check(self, cr, uid, emp_id, dt=False,context={}): + cr.execute('select max(name) from hr_attendance where employee_id=%d', (emp_id,)) + res = cr.fetchone() + return not (res and (res[0]>=(dt or time.strftime('%Y-%m-%d %H:%M:%S')))) + + def sign_in(self, cr, uid, ids, context={}, dt=False, *args): + id = False + for emp in self.browse(cr, uid, ids): + if not self._action_check(cr, uid, emp.id, dt, context): + raise osv.except_osv(_('Warning'), _('You tried to sign in with a date anterior to another event !\nTry to contact the administrator to correct attendances.')) + res = {'action':'sign_in', 'employee_id':emp.id} + if dt: + res['name'] = dt + id = self.pool.get('hr.attendance').create(cr, uid, res, context=context) + return id + +hr_employee() + +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/hr_attendance/hr_attendance_demo.xml b/addons/hr_attendance/hr_attendance_demo.xml new file mode 100644 index 00000000000..640d6b5257a --- /dev/null +++ b/addons/hr_attendance/hr_attendance_demo.xml @@ -0,0 +1,108 @@ +<?xml version="1.0" encoding="utf-8"?> +<openerp> + <data> + + + + <record id="attendance1" model="hr.attendance"> + <field eval="time.strftime('%Y-%m-01 08:21')" name="name"/> + <field name="action">sign_in</field> + <field name="employee_id" ref="hr.employee1"/> + </record> + <record id="attendance2" model="hr.attendance"> + <field eval="time.strftime('%Y-%m-01 11:51')" name="name"/> + <field name="action">sign_out</field> + <field name="employee_id" ref="hr.employee1"/> + </record> + <record id="attendance3" model="hr.attendance"> + <field eval="time.strftime('%Y-%m-02 12:47')" name="name"/> + <field name="action">sign_in</field> + <field name="employee_id" ref="hr.employee1"/> + </record> + <record id="attendance4" model="hr.attendance"> + <field eval="time.strftime('%Y-%m-02 19:53')" name="name"/> + <field name="action">sign_out</field> + <field name="employee_id" ref="hr.employee1"/> + </record> + <record id="attendance5" model="hr.attendance"> + <field eval="time.strftime('%Y-%m-03 07:32')" name="name"/> + <field name="action">sign_in</field> + <field name="employee_id" ref="hr.employee1"/> + </record> + <record id="attendance6" model="hr.attendance"> + <field eval="time.strftime('%Y-%m-03 12:32')" name="name"/> + <field name="action">sign_out</field> + <field name="employee_id" ref="hr.employee1"/> + </record> + <record id="attendance7" model="hr.attendance"> + <field eval="time.strftime('%Y-%m-04 14:01')" name="name"/> + <field name="action">sign_in</field> + <field name="employee_id" ref="hr.employee1"/> + </record> + <record id="attendance8" model="hr.attendance"> + <field eval="time.strftime('%Y-%m-04 17:21')" name="name"/> + <field name="action">sign_out</field> + <field name="employee_id" ref="hr.employee1"/> + </record> + <record id="attendance9" model="hr.attendance"> + <field eval="time.strftime('%Y-%m-05 09:10')" name="name"/> + <field name="action">sign_in</field> + <field name="employee_id" ref="hr.employee1"/> + </record> + <record id="attendance10" model="hr.attendance"> + <field eval="time.strftime('%Y-%m-05 12:42')" name="name"/> + <field name="action">sign_out</field> + <field name="employee_id" ref="hr.employee1"/> + </record> + <record id="attendance11" model="hr.attendance"> + <field eval="time.strftime('%Y-%m-06 13:10')" name="name"/> + <field name="action">sign_in</field> + <field name="employee_id" ref="hr.employee1"/> + </record> + <record id="attendance12" model="hr.attendance"> + <field eval="time.strftime('%Y-%m-06 18:34')" name="name"/> + <field name="action">sign_out</field> + <field name="employee_id" ref="hr.employee1"/> + </record> + <record id="attendance13" model="hr.attendance"> + <field eval="time.strftime('%Y-%m-07 08:21')" name="name"/> + <field name="action">sign_in</field> + <field name="employee_id" ref="hr.employee1"/> + </record> + <record id="attendance14" model="hr.attendance"> + <field eval="time.strftime('%Y-%m-07 18:21')" name="name"/> + <field name="action">sign_out</field> + <field name="employee_id" ref="hr.employee1"/> + </record> + <record id="attendance15" model="hr.attendance"> + <field eval="time.strftime('%Y-%m-08 08:21')" name="name"/> + <field name="action">sign_in</field> + <field name="employee_id" ref="hr.employee1"/> + </record> + <record id="attendance16" model="hr.attendance"> + <field eval="time.strftime('%Y-%m-08 12:54')" name="name"/> + <field name="action">sign_out</field> + <field name="employee_id" ref="hr.employee1"/> + </record> + <record id="attendance17" model="hr.attendance"> + <field eval="time.strftime('%Y-%m-09 13:32')" name="name"/> + <field name="action">sign_in</field> + <field name="employee_id" ref="hr.employee1"/> + </record> + <record id="attendance18" model="hr.attendance"> + <field eval="time.strftime('%Y-%m-09 19:31')" name="name"/> + <field name="action">sign_out</field> + <field name="employee_id" ref="hr.employee1"/> + </record> + <record id="attendance19" model="hr.attendance"> + <field eval="time.strftime('%Y-%m-10 07:10')" name="name"/> + <field name="action">sign_in</field> + <field name="employee_id" ref="hr.employee1"/> + </record> + <record id="attendance20" model="hr.attendance"> + <field eval="time.strftime('%Y-%m-10 12:34')" name="name"/> + <field name="action">sign_out</field> + <field name="employee_id" ref="hr.employee1"/> + </record> + </data> +</openerp> diff --git a/addons/hr/hr_report.xml b/addons/hr_attendance/hr_attendance_report.xml index a0d3497c9aa..a0d3497c9aa 100644 --- a/addons/hr/hr_report.xml +++ b/addons/hr_attendance/hr_attendance_report.xml diff --git a/addons/hr_attendance/hr_attendance_view.xml b/addons/hr_attendance/hr_attendance_view.xml new file mode 100644 index 00000000000..fe2b1e6f0dc --- /dev/null +++ b/addons/hr_attendance/hr_attendance_view.xml @@ -0,0 +1,102 @@ +<?xml version="1.0" encoding="utf-8"?> +<openerp> + <data> + + <record id="view_attendance_form" model="ir.ui.view"> + <field name="name">hr.attendance.form</field> + <field name="model">hr.attendance</field> + <field name="type">form</field> + <field name="arch" type="xml"> + <form string="Employee attendance"> + <field name="employee_id" select="1"/> + <field colspan="4" name="name" select="1"/> + <field name="action" select="1"/> + <field name="action_desc" select="1"/> + </form> + </field> + </record> + <record id="view_attendance_tree" model="ir.ui.view"> + <field name="name">hr.attendance.tree</field> + <field name="model">hr.attendance</field> + <field name="type">tree</field> + <field name="arch" type="xml"> + <tree string="Employee attendances"> + <field name="name"/> + <field name="action"/> + <field name="action_desc"/> + </tree> + </field> + </record> + + <record id="view_attendance_who" model="ir.ui.view"> + <field name="name">hr.attendance.tree</field> + <field name="model">hr.attendance</field> + <field name="type">tree</field> + <field eval="3" name="priority"/> + <field name="arch" type="xml"> + <tree string="Employee attendance"> + <field name="employee_id"/> + <field name="name"/> + <field name="action"/> + <field name="action_desc"/> + </tree> + </field> + </record> + <record id="open_view_attendance" model="ir.actions.act_window"> + <field name="name">Attendances</field> + <field name="res_model">hr.attendance</field> + <field name="view_type">form</field> + <field name="view_mode">tree,form</field> + </record> + <menuitem id="menu_hr_attendance" name="Attendances" parent="hr.menu_hr_root"/> + <menuitem action="open_view_attendance" id="menu_open_view_attendance" parent="menu_hr_attendance"/> + + + <record id="edit_attendance_reason" model="ir.ui.view"> + <field name="name">hr.action.reason.form</field> + <field name="model">hr.action.reason</field> + <field name="type">form</field> + <field name="arch" type="xml"> + <form string="Define attendance reason"> + <field colspan="4" name="name" select="1"/> + <field name="action_type" select="1"/> + </form> + </field> + </record> + <record id="view_attendance_reason" model="ir.ui.view"> + <field name="name">hr.action.reason.tree</field> + <field name="model">hr.action.reason</field> + <field name="type">tree</field> + <field name="arch" type="xml"> + <tree string="Attendance reasons"> + <field name="name"/> + <field name="action_type"/> + </tree> + </field> + </record> + <record id="open_view_attendance_reason" model="ir.actions.act_window"> + <field name="name">Attendance Reasons</field> + <field name="type">ir.actions.act_window</field> + <field name="res_model">hr.action.reason</field> + <field name="view_type">form</field> + <field name="view_mode">tree,form</field> + <field name="view_id" ref="view_attendance_reason"/> + </record> + <menuitem action="open_view_attendance_reason" id="menu_open_view_attendance_reason" parent="hr.menu_hr_configuration"/> + + <record id="hr_attendance_employee" model="ir.ui.view"> + <field name="name">hr.employee.form1</field> + <field name="model">hr.employee</field> + <field name="type">form</field> + <field name="inherit_id" ref="hr.view_employee_form"/> + <field name="arch" type="xml"> + <field name="parent_id" position="after"> + <field name="state"/> + <button name="sign_in" states="absent" string="Sign In" type="object"/> + <button name="sign_out" states="present" string="Sign Out" type="object"/> + </field> + </field> + </record> + + </data> +</openerp> diff --git a/addons/hr_attendance/hr_attendance_wizard.xml b/addons/hr_attendance/hr_attendance_wizard.xml new file mode 100644 index 00000000000..707e63a4460 --- /dev/null +++ b/addons/hr_attendance/hr_attendance_wizard.xml @@ -0,0 +1,11 @@ +<?xml version="1.0" encoding="utf-8"?> +<openerp> + <data> + + <wizard id="si_so" model="hr.employee" name="hr.si_so" string="Sign in / Sign out"/> + <wizard id="wizard_attendance_error" keyword="client_print_multi" model="hr.employee" name="hr.timesheet.attendance.report" string="Print Attendance Error Report"/> + + <menuitem action="si_so" id="menu_si_so" parent="menu_hr_attendance" type="wizard"/> + + </data> +</openerp> diff --git a/addons/hr_attendance/report/__init__.py b/addons/hr_attendance/report/__init__.py new file mode 100644 index 00000000000..c9f1ff7008a --- /dev/null +++ b/addons/hr_attendance/report/__init__.py @@ -0,0 +1,32 @@ +# -*- encoding: utf-8 -*- +############################################################################## +# +# Copyright (c) 2004-2008 TINY SPRL. (http://tiny.be) All Rights Reserved. +# +# $Id$ +# +# WARNING: This program as such is intended to be used by professional +# programmers who take the whole responsability of assessing all potential +# consequences resulting from its eventual inadequacies and bugs +# End users who are looking for a ready-to-use solution with commercial +# garantees and support are strongly adviced to contract a Free Software +# Service Company +# +# This program is Free Software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +############################################################################## +import attendance_errors + +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/hr/report/attendance_errors.py b/addons/hr_attendance/report/attendance_errors.py index 231fe98b8e5..286fad59f67 100644 --- a/addons/hr/report/attendance_errors.py +++ b/addons/hr_attendance/report/attendance_errors.py @@ -81,7 +81,7 @@ class attendance_print(report_sxw.rml_parse): return (self._sign(total),total2 and self._sign(total2)) -report_sxw.report_sxw('report.hr.timesheet.attendance.error', 'hr.employee', 'addons/hr/report/attendance_errors.rml',parser=attendance_print) +report_sxw.report_sxw('report.hr.timesheet.attendance.error', 'hr.employee', 'addons/hr_attendance/report/attendance_errors.rml',parser=attendance_print) # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/hr/report/attendance_errors.rml b/addons/hr_attendance/report/attendance_errors.rml index a2d9ebe3625..aacdde99e06 100644 --- a/addons/hr/report/attendance_errors.rml +++ b/addons/hr_attendance/report/attendance_errors.rml @@ -10,7 +10,7 @@ <blockAlignment value="LEFT"/> <blockValign value="TOP"/> </blockTableStyle> - <blockTableStyle id="Table1"> + <blockTableStyle id="Table_employee_detail_header"> <blockAlignment value="LEFT"/> <blockValign value="TOP"/> <lineStyle kind="LINEBELOW" colorName="#000000" start="0,-1" stop="0,-1"/> @@ -33,7 +33,7 @@ <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="3,-1" stop="3,-1"/> <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="4,-1" stop="4,-1"/> </blockTableStyle> - <blockTableStyle id="tbl_header"> + <blockTableStyle id="Table_employee_detail_content"> <blockAlignment value="LEFT"/> <blockValign value="TOP"/> <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="0,-1" stop="0,-1"/> @@ -42,7 +42,7 @@ <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="3,-1" stop="3,-1"/> <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="4,-1" stop="4,-1"/> </blockTableStyle> - <blockTableStyle id="Table3"> + <blockTableStyle id="Table_employee_total"> <blockAlignment value="LEFT"/> <blockValign value="TOP"/> <lineStyle kind="LINEABOVE" colorName="#ffffff" start="0,0" stop="0,0"/> @@ -52,7 +52,6 @@ <initialize> <paraStyle name="all" alignment="justify"/> </initialize> - <paraStyle name="P1" fontName="Helvetica-Oblique" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/> <paraStyle name="Standard" fontName="Times-Roman"/> <paraStyle name="Text body" fontName="Times-Roman" spaceBefore="0.0" spaceAfter="6.0"/> <paraStyle name="Heading" fontName="Helvetica" fontSize="14.0" leading="17" spaceBefore="12.0" spaceAfter="6.0"/> @@ -71,6 +70,18 @@ <paraStyle name="terp_default_Bold_8" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/> <paraStyle name="terp_default_Bold_9" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/> <paraStyle name="terp_default_Centre_9_Bold" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/> + <paraStyle name="Footer" fontName="Times-Roman"/> + <paraStyle name="Table Heading" fontName="Times-Roman" alignment="CENTER"/> + <paraStyle name="Horizontal Line" fontName="Times-Roman" fontSize="6.0" leading="8" spaceBefore="0.0" spaceAfter="14.0"/> + <paraStyle name="Heading 9" fontName="Helvetica-Bold" fontSize="75%" leading="NaN" spaceBefore="12.0" spaceAfter="6.0"/> + <paraStyle name="terp_tblheader_General" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="6.0" spaceAfter="6.0"/> + <paraStyle name="terp_tblheader_General_Centre" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="CENTER" spaceBefore="6.0" spaceAfter="6.0"/> + <paraStyle name="terp_tblheader_General_Right" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="RIGHT" spaceBefore="6.0" spaceAfter="6.0"/> + <paraStyle name="terp_tblheader_Details_Right" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="6.0" spaceAfter="6.0"/> + <paraStyle name="terp_default_Right_8" fontName="Helvetica" fontSize="8.0" leading="10" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/> + <paraStyle name="terp_header_Right" fontName="Helvetica-Bold" fontSize="15.0" leading="19" alignment="LEFT" spaceBefore="12.0" spaceAfter="6.0"/> + <paraStyle name="terp_default_address" fontName="Helvetica" fontSize="10.0" leading="13" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/> + <paraStyle name="terp_default_Right_9" fontName="Helvetica" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/> </stylesheet> <images/> <story> @@ -80,10 +91,10 @@ <para style="terp_default_8"> <font color="white"> </font> </para> - <blockTable colWidths="60.0,114.0,146.0,85.0,77.0" style="Table1"> + <blockTable colWidths="60.0,114.0,146.0,85.0,77.0" style="Table_employee_detail_header"> <tr> <td> - <para style="terp_tblheader_Details">Operation</para> + <para style="terp_tblheader_Details_Centre">Operation</para> </td> <td> <para style="terp_tblheader_Details_Centre">Date Signed</para> @@ -102,11 +113,11 @@ <blockTable colWidths="482.0" style="tbl_detail"> <tr> <td> - <para style="P1">[[ repeatIn(lst(employee.id,data['form']['init_date'], data['form']['end_date'], data['form']['max_delay']), 'att') ]]</para> - <blockTable colWidths="58.0,114.0,143.0,93.0,69.0" style="tbl_header"> + <para style="terp_default_8">[[ repeatIn(lst(employee.id,data['form']['init_date'], data['form']['end_date'], data['form']['max_delay']), 'att') ]]</para> + <blockTable colWidths="58.0,114.0,143.0,93.0,69.0" style="Table_employee_detail_content"> <tr> <td> - <para style="terp_default_9">[[ att['action'] ]]</para> + <para style="terp_default_Centre_9">[[ att['action'] ]]</para> </td> <td> <para style="terp_default_Centre_9">[[ att['date'] ]]</para> @@ -125,7 +136,7 @@ </td> </tr> </blockTable> - <blockTable colWidths="319.0,99.0,63.0" style="Table3"> + <blockTable colWidths="319.0,99.0,63.0" style="Table_employee_total"> <tr> <td> <para style="terp_default_Bold_9">Total period:</para> @@ -138,10 +149,10 @@ </td> </tr> </blockTable> - <para style="terp_default_9"> + <para style="terp_default_8"> <font color="white"> </font> </para> - <para style="terp_default_9">(*) A positive delay means that the employee worked less than recorded.</para> - <para style="terp_default_9">(*) A negative delay means that the employee worked more than encoded.</para> + <para style="terp_default_8">(*) A positive delay means that the employee worked less than recorded.</para> + <para style="terp_default_8">(*) A negative delay means that the employee worked more than encoded.</para> </story> </document> diff --git a/addons/hr_attendance/wizard/__init__.py b/addons/hr_attendance/wizard/__init__.py new file mode 100644 index 00000000000..447b2047f2c --- /dev/null +++ b/addons/hr_attendance/wizard/__init__.py @@ -0,0 +1,33 @@ +# -*- encoding: utf-8 -*- +############################################################################## +# +# Copyright (c) 2004-2008 TINY SPRL. (http://tiny.be) All Rights Reserved. +# +# $Id$ +# +# WARNING: This program as such is intended to be used by professional +# programmers who take the whole responsability of assessing all potential +# consequences resulting from its eventual inadequacies and bugs +# End users who are looking for a ready-to-use solution with commercial +# garantees and support are strongly adviced to contract a Free Software +# Service Company +# +# This program is Free Software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +############################################################################## +import sign_in_out +import print_attendance_error + +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/hr_attendance/wizard/sign_in_out.py b/addons/hr_attendance/wizard/sign_in_out.py new file mode 100644 index 00000000000..a3e82b9d669 --- /dev/null +++ b/addons/hr_attendance/wizard/sign_in_out.py @@ -0,0 +1,194 @@ +# -*- encoding: utf-8 -*- +############################################################################## +# +# Copyright (c) 2004-2008 TINY SPRL. (http://tiny.be) All Rights Reserved. +# +# $Id$ +# +# WARNING: This program as such is intended to be used by professional +# programmers who take the whole responsability of assessing all potential +# consequences resulting from its eventual inadequacies and bugs +# End users who are looking for a ready-to-use solution with commercial +# garantees and support are strongly adviced to contract a Free Software +# Service Company +# +# This program is Free Software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +############################################################################## + +import wizard +import netsvc +import time +from tools.translate import _ + +si_so_form ='''<?xml version="1.0"?> +<form string="Sign in / Sign out"> + <separator string="You are now ready to sign in or out of the attendance follow up" colspan="4" /> + <field name="name" readonly="True" /> + <field name="state" readonly="True" /> +</form>''' + +si_so_fields = { + 'name' : {'string' : "Employee's name", 'type':'char', 'required':True, 'readonly':True}, + 'state' : {'string' : "Current state", 'type' : 'char', 'required' : True, 'readonly': True}, +} + +si_form = '''<?xml version="1.0" ?> +<form string="Sign in status"> + <seperator string="This is the status of your sign in request. Check it out maybe you were already signed in." colspan="4" /> + <field name="success" readonly="True" /> +</form>''' + +si_fields = { + 'success' : {'string' : "Sign in's status", 'type' : 'char', 'required' : True, 'readonly' : True}, +} + +so_form = '''<?xml version="1.0" ?> +<form string="Sign in status"> + <seperator string="This is the status of your sign out request. Check it out maybe you were already signed out." colspan="4" /> + <field name="success" readonly="True" /> +</for>''' + +so_fields = { + 'success' : {'string' : "Sign out's status", 'type' : 'char', 'required' : True, 'readonly' : True}, +} + +def _get_empid(self, cr, uid, data, context): + service = netsvc.LocalService('object_proxy') + emp_id = service.execute(cr.dbname, uid, 'hr.employee', 'search', [('user_id', '=', uid)]) + print "EMP :::::::::", emp_id + if emp_id: + print "IF ::::::::" + employee = service.execute(cr.dbname, uid, 'hr.employee', 'read', emp_id)[0] + print "employee .........", employee + return {'name': employee['name'], 'state': employee['state'], 'emp_id': emp_id[0]} + return {} + +def _sign_in(self, cr, uid, data, context): + service = netsvc.LocalService('object_proxy') + emp_id = data['form']['emp_id'] + if 'last_time' in data['form'] : + if data['form']['last_time'] > time.strftime('%Y-%m-%d'): + raise wizard.except_wizard(_('UserError'), _('The sign-out date must be in the past')) + return {'success': False} + service.execute(cr.dbname, uid, 'hr.attendance', 'create', { + 'name': data['form']['last_time'], + 'action': 'sign_out', + 'employee_id': emp_id + }) + try: + success = service.execute(cr.dbname, uid, 'hr.employee', 'sign_in', [emp_id]) + print success + except: + raise wizard.except_wizard(_('UserError'), _('A sign-in must be right after a sign-out !')) + return {'success': success} + +def _sign_out(self, cr, uid, data, context): + service = netsvc.LocalService('object_proxy') + emp_id = data['form']['emp_id'] + if 'last_time' in data['form'] : + if data['form']['last_time'] > time.strftime('%Y-%m-%d'): + raise wizard.except_wizard(_('UserError'), _('The Sign-in date must be in the past')) + return {'success': False} + service.execute(cr.dbname, uid, 'hr.attendance', 'create', {'name':data['form']['last_time'], 'action':'sign_in', 'employee_id':emp_id}) + try: + success = service.execute(cr.dbname, uid, 'hr.employee', 'sign_out', [emp_id]) + except: + raise wizard.except_wizard(_('UserError'), _('A sign-out must be right after a sign-in !')) + + return {'success' : success} + +so_ask_form ='''<?xml version="1.0"?> +<form string="Sign in / Sign out"> + <separator string="You did not signed out the last time. Please enter the date and time you signed out." colspan="4" /> + <field name="name" readonly="True" /> + <field name="last_time" /> +</form>''' + +so_ask_fields = { + 'name' : {'string' : "Employee's name", 'type':'char', 'required':True, 'readonly':True}, + 'last_time' : {'string' : "Your last sign out", 'type' : 'datetime', 'required' : True}, +} + +def _si_check(self, cr, uid, data, context): + states = {True : 'si', False: 'si_ask_so'} + service = netsvc.LocalService('object_proxy') + emp_id = data['form']['emp_id'] + att_id = service.execute(cr.dbname, uid, 'hr.attendance', 'search', [('employee_id', '=', emp_id)], limit=1, order='name desc') + last_att = service.execute(cr.dbname, uid, 'hr.attendance', 'read', att_id) + if last_att: + last_att = last_att[0] + cond = not last_att or last_att['action'] == 'sign_out' + return states[cond] + +si_ask_form ='''<?xml version="1.0"?> +<form string="Sign in / Sign out"> + <separator string="You did not signed in the last time. Please enter the date and time you signed in." colspan="4" /> + <field name="name" readonly="True" /> + <field name="last_time" /> +</form>''' + +si_ask_fields = { + 'name' : {'string' : "Employee's name", 'type':'char', 'required':True, 'readonly':True}, + 'last_time' : {'string' : "Your last sign in", 'type' : 'datetime', 'required' : True}, +} + +def _so_check(self, cr, uid, data, context): + states = {True : 'so', False: 'so_ask_si'} + service = netsvc.LocalService('object_proxy') + emp_id = data['form']['emp_id'] + att_id = service.execute(cr.dbname, uid, 'hr.attendance', 'search', [('employee_id', '=', emp_id)], limit=1, order='name desc') + last_att = service.execute(cr.dbname, uid, 'hr.attendance', 'read', att_id) + if last_att: + last_att = last_att[0] + cond = last_att and last_att['action'] == 'sign_in' + return states[cond] + +class wiz_si_so(wizard.interface): + states = { + 'init' : { + 'actions' : [_get_empid], + 'result' : {'type' : 'form', 'arch' : si_so_form, 'fields' : si_so_fields, 'state' : [('end', 'Cancel'),('si_test', 'Sign in'),('so_test', 'Sign out')] } + }, + 'si_test' : { + 'actions' : [], + 'result' : {'type' : 'choice', 'next_state': _si_check} + }, + 'si_ask_so' : { + 'actions' : [], + 'result' : {'type' : 'form', 'arch' : so_ask_form, 'fields' : so_ask_fields, 'state' : [('end', 'Cancel'),('si', 'Sign in') ] } + }, + 'si' : { + 'actions' : [_sign_in], + 'result' : {'type' : 'state', 'state':'end'} + }, + 'so_test' : { + 'actions' : [], + 'result' : {'type' : 'choice', 'next_state': _so_check } + }, + 'so_ask_si' : { + 'actions' : [], + 'result' : {'type' : 'form', 'arch' : si_ask_form, 'fields' : si_ask_fields, 'state' : [('end', 'Cancel'),('so', 'Sign out')] } + }, + 'so' : { + 'actions' : [_sign_out], + 'result' : {'type' : 'state', 'state':'end'} + }, + } +wiz_si_so('hr.si_so') + + +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: + diff --git a/addons/hr_expense/report/expense.rml b/addons/hr_expense/report/expense.rml index f42dfb11761..6d2be72d4e7 100644 --- a/addons/hr_expense/report/expense.rml +++ b/addons/hr_expense/report/expense.rml @@ -10,7 +10,35 @@ <blockAlignment value="LEFT"/> <blockValign value="TOP"/> </blockTableStyle> - <blockTableStyle id="Table2"> + <blockTableStyle id="Table_employee_ref_header"> + <blockAlignment value="LEFT"/> + <blockValign value="TOP"/> + <lineStyle kind="LINEBEFORE" colorName="#e6e6e6" start="0,0" stop="0,-1"/> + <lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="0,0" stop="0,0"/> + <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="0,-1" stop="0,-1"/> + <lineStyle kind="LINEBEFORE" colorName="#e6e6e6" start="1,0" stop="1,-1"/> + <lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="1,0" stop="1,0"/> + <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="1,-1" stop="1,-1"/> + <lineStyle kind="LINEBEFORE" colorName="#e6e6e6" start="2,0" stop="2,-1"/> + <lineStyle kind="LINEAFTER" colorName="#e6e6e6" start="2,0" stop="2,-1"/> + <lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="2,0" stop="2,0"/> + <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="2,-1" stop="2,-1"/> + </blockTableStyle> + <blockTableStyle id="Table_employee_ref_content"> + <blockAlignment value="LEFT"/> + <blockValign value="TOP"/> + <lineStyle kind="LINEBEFORE" colorName="#e6e6e6" start="0,0" stop="0,-1"/> + <lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="0,0" stop="0,0"/> + <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="0,-1" stop="0,-1"/> + <lineStyle kind="LINEBEFORE" colorName="#e6e6e6" start="1,0" stop="1,-1"/> + <lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="1,0" stop="1,0"/> + <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="1,-1" stop="1,-1"/> + <lineStyle kind="LINEBEFORE" colorName="#e6e6e6" start="2,0" stop="2,-1"/> + <lineStyle kind="LINEAFTER" colorName="#e6e6e6" start="2,0" stop="2,-1"/> + <lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="2,0" stop="2,0"/> + <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="2,-1" stop="2,-1"/> + </blockTableStyle> + <blockTableStyle id="Table_employee_detail_header"> <blockAlignment value="LEFT"/> <blockValign value="TOP"/> <lineStyle kind="LINEBELOW" colorName="#000000" start="0,-1" stop="0,-1"/> @@ -27,76 +55,30 @@ <lineStyle kind="LINEBELOW" colorName="#cccccc" start="1,-1" stop="1,-1"/> <lineStyle kind="LINEBELOW" colorName="#cccccc" start="2,-1" stop="2,-1"/> <lineStyle kind="LINEBELOW" colorName="#cccccc" start="3,-1" stop="3,-1"/> - <lineStyle kind="LINEBEFORE" colorName="#000000" start="4,0" stop="4,-1"/> - <lineStyle kind="LINEABOVE" colorName="#000000" start="4,0" stop="4,0"/> - <lineStyle kind="LINEBELOW" colorName="#000000" start="4,-1" stop="4,-1"/> - <lineStyle kind="LINEBEFORE" colorName="#000000" start="5,0" stop="5,-1"/> - <lineStyle kind="LINEAFTER" colorName="#000000" start="5,0" stop="5,-1"/> - <lineStyle kind="LINEABOVE" colorName="#000000" start="5,0" stop="5,0"/> - <lineStyle kind="LINEBELOW" colorName="#000000" start="5,-1" stop="5,-1"/> + <lineStyle kind="LINEBELOW" colorName="#cccccc" start="4,-1" stop="4,-1"/> + <lineStyle kind="LINEBELOW" colorName="#cccccc" start="5,-1" stop="5,-1"/> <lineStyle kind="LINEBELOW" colorName="#cccccc" start="6,-1" stop="6,-1"/> <lineStyle kind="LINEBELOW" colorName="#cccccc" start="7,-1" stop="7,-1"/> - <lineStyle kind="LINEBELOW" colorName="#cccccc" start="8,-1" stop="8,-1"/> - <lineStyle kind="LINEBELOW" colorName="#cccccc" start="9,-1" stop="9,-1"/> <lineStyle kind="LINEBELOW" colorName="#cccccc" start="0,-1" stop="0,-1"/> <lineStyle kind="LINEBELOW" colorName="#cccccc" start="1,-1" stop="1,-1"/> <lineStyle kind="LINEBELOW" colorName="#cccccc" start="2,-1" stop="2,-1"/> - <lineStyle kind="LINEBEFORE" colorName="#000000" start="3,1" stop="3,-1"/> - <lineStyle kind="LINEABOVE" colorName="#000000" start="3,1" stop="3,1"/> - <lineStyle kind="LINEBELOW" colorName="#000000" start="3,-1" stop="3,-1"/> - <lineStyle kind="LINEBEFORE" colorName="#000000" start="4,1" stop="4,-1"/> - <lineStyle kind="LINEAFTER" colorName="#000000" start="4,1" stop="4,-1"/> - <lineStyle kind="LINEABOVE" colorName="#000000" start="4,1" stop="4,1"/> - <lineStyle kind="LINEBELOW" colorName="#000000" start="4,-1" stop="4,-1"/> + <lineStyle kind="LINEBELOW" colorName="#cccccc" start="3,-1" stop="3,-1"/> + <lineStyle kind="LINEBELOW" colorName="#cccccc" start="4,-1" stop="4,-1"/> <lineStyle kind="LINEBELOW" colorName="#cccccc" start="5,-1" stop="5,-1"/> <lineStyle kind="LINEBELOW" colorName="#cccccc" start="6,-1" stop="6,-1"/> - <lineStyle kind="LINEBELOW" colorName="#cccccc" start="7,-1" stop="7,-1"/> - <lineStyle kind="LINEBELOW" colorName="#cccccc" start="8,-1" stop="8,-1"/> - <lineStyle kind="LINEBEFORE" colorName="#000000" start="0,2" stop="0,-1"/> - <lineStyle kind="LINEABOVE" colorName="#000000" start="0,2" stop="0,2"/> - <lineStyle kind="LINEBELOW" colorName="#000000" start="0,-1" stop="0,-1"/> - <lineStyle kind="LINEBEFORE" colorName="#000000" start="1,2" stop="1,-1"/> - <lineStyle kind="LINEAFTER" colorName="#000000" start="1,2" stop="1,-1"/> - <lineStyle kind="LINEABOVE" colorName="#000000" start="1,2" stop="1,2"/> - <lineStyle kind="LINEBELOW" colorName="#000000" start="1,-1" stop="1,-1"/> </blockTableStyle> - <blockTableStyle id="Table3"> + <blockTableStyle id="Table_employee_detail_content"> <blockAlignment value="LEFT"/> <blockValign value="TOP"/> <lineStyle kind="LINEBELOW" colorName="#cccccc" start="0,-1" stop="0,-1"/> <lineStyle kind="LINEBELOW" colorName="#cccccc" start="1,-1" stop="1,-1"/> <lineStyle kind="LINEBELOW" colorName="#cccccc" start="2,-1" stop="2,-1"/> - <lineStyle kind="LINEBEFORE" colorName="#000000" start="3,0" stop="3,-1"/> - <lineStyle kind="LINEABOVE" colorName="#000000" start="3,0" stop="3,0"/> - <lineStyle kind="LINEBELOW" colorName="#000000" start="3,-1" stop="3,-1"/> - <lineStyle kind="LINEBEFORE" colorName="#000000" start="4,0" stop="4,-1"/> - <lineStyle kind="LINEAFTER" colorName="#000000" start="4,0" stop="4,-1"/> - <lineStyle kind="LINEABOVE" colorName="#000000" start="4,0" stop="4,0"/> - <lineStyle kind="LINEBELOW" colorName="#000000" start="4,-1" stop="4,-1"/> + <lineStyle kind="LINEBELOW" colorName="#cccccc" start="3,-1" stop="3,-1"/> + <lineStyle kind="LINEBELOW" colorName="#cccccc" start="4,-1" stop="4,-1"/> <lineStyle kind="LINEBELOW" colorName="#cccccc" start="5,-1" stop="5,-1"/> <lineStyle kind="LINEBELOW" colorName="#cccccc" start="6,-1" stop="6,-1"/> - <lineStyle kind="LINEBELOW" colorName="#cccccc" start="7,-1" stop="7,-1"/> - <lineStyle kind="LINEBELOW" colorName="#cccccc" start="8,-1" stop="8,-1"/> - <lineStyle kind="LINEBEFORE" colorName="#000000" start="0,1" stop="0,-1"/> - <lineStyle kind="LINEABOVE" colorName="#000000" start="0,1" stop="0,1"/> - <lineStyle kind="LINEBELOW" colorName="#000000" start="0,-1" stop="0,-1"/> - <lineStyle kind="LINEBEFORE" colorName="#000000" start="1,1" stop="1,-1"/> - <lineStyle kind="LINEAFTER" colorName="#000000" start="1,1" stop="1,-1"/> - <lineStyle kind="LINEABOVE" colorName="#000000" start="1,1" stop="1,1"/> - <lineStyle kind="LINEBELOW" colorName="#000000" start="1,-1" stop="1,-1"/> </blockTableStyle> - <blockTableStyle id="Table5"> - <blockAlignment value="LEFT"/> - <blockValign value="TOP"/> - <lineStyle kind="LINEBEFORE" colorName="#000000" start="0,0" stop="0,-1"/> - <lineStyle kind="LINEABOVE" colorName="#000000" start="0,0" stop="0,0"/> - <lineStyle kind="LINEBELOW" colorName="#000000" start="0,-1" stop="0,-1"/> - <lineStyle kind="LINEBEFORE" colorName="#000000" start="1,0" stop="1,-1"/> - <lineStyle kind="LINEAFTER" colorName="#000000" start="1,0" stop="1,-1"/> - <lineStyle kind="LINEABOVE" colorName="#000000" start="1,0" stop="1,0"/> - <lineStyle kind="LINEBELOW" colorName="#000000" start="1,-1" stop="1,-1"/> - </blockTableStyle> - <blockTableStyle id="Table4"> + <blockTableStyle id="Table_employee_total"> <blockAlignment value="LEFT"/> <blockValign value="TOP"/> <lineStyle kind="LINEABOVE" colorName="#ffffff" start="0,0" stop="0,0"/> @@ -107,13 +89,6 @@ <initialize> <paraStyle name="all" alignment="justify"/> </initialize> - <paraStyle name="P1" fontName="Times-Bold" fontSize="14.0" leading="17" alignment="LEFT"/> - <paraStyle name="P2" fontName="Times-Roman" fontSize="14.0" leading="17"/> - <paraStyle name="P3" fontName="Times-Roman" fontSize="14.0" leading="17" alignment="LEFT"/> - <paraStyle name="P4" fontName="Times-Bold" fontSize="10.0" leading="13" alignment="LEFT"/> - <paraStyle name="P5" fontName="Times-Roman" fontSize="14.0" leading="17" alignment="LEFT"/> - <paraStyle name="P6" rightIndent="-0.0" leftIndent="-3.0" fontName="Helvetica" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="P7" fontName="Helvetica" fontSize="9.0" leading="11" alignment="CENTER"/> <paraStyle name="Standard" fontName="Times-Roman"/> <paraStyle name="Text body" fontName="Times-Roman" spaceBefore="0.0" spaceAfter="6.0"/> <paraStyle name="Heading" fontName="Helvetica" fontSize="14.0" leading="17" spaceBefore="12.0" spaceAfter="6.0"/> @@ -140,7 +115,7 @@ <paraStyle name="terp_header_Centre" fontName="Helvetica-Bold" fontSize="14.0" leading="17" alignment="CENTER" spaceBefore="12.0" spaceAfter="6.0"/> <paraStyle name="terp_default_address" fontName="Helvetica" fontSize="10.0" leading="13" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/> <paraStyle name="terp_default_9" fontName="Helvetica" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="terp_default_Bold_9" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/> + <paraStyle name="terp_default_Bold_centre_9" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/> <paraStyle name="terp_default_Centre_9" fontName="Helvetica" fontSize="9.0" leading="11" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/> <paraStyle name="terp_default_Right_9" fontName="Helvetica" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/> <paraStyle name="terp_default_1" fontName="Helvetica" fontSize="2.0" leading="3" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/> @@ -148,18 +123,44 @@ </stylesheet> <images/> <story> - <para style="P2">[[ repeatIn(objects,'o') ]]</para> + <para style="terp_default_8">[[ repeatIn(objects,'o') ]]</para> <para style="terp_header_Centre">HR Expenses [[ o.name or '' ]]</para> - <para style="P1"> + <para style="terp_default_8"> <font color="white"> </font> </para> - <para style="terp_header">Employee: <font face="Times-Roman">[[ o.employee_id.name ]]</font><font face="Times-Roman"/></para> - <para style="terp_default_9">Date: <font face="Times-Roman">[[ time.strftime('%d/%m/%Y', time.strptime(o.date, '%Y-%m-%d')) ]]</font></para> - <para style="terp_default_9">Reference: <font face="Times-Roman">[[ o.ref ]]</font></para> - <para style="P3"> + <blockTable colWidths="174.0,174.0,174.0" style="Table_employee_ref_header"> + <tr> + <td> + <para style="terp_tblheader_General_Centre">Employee</para> + </td> + <td> + <para style="terp_tblheader_General_Centre">Date</para> + </td> + <td> + <para style="terp_tblheader_General_Centre">Reference</para> + </td> + </tr> + </blockTable> + <blockTable colWidths="174.0,174.0,174.0" style="Table_employee_ref_content"> + <tr> + <td> + <para style="terp_default_Centre_8">[[ o.employee_id.name ]] </para> + </td> + <td> + <para style="terp_default_Centre_8">[[ time.strftime('%d/%m/%Y', time.strptime(o.date, '%Y-%m-%d')) ]]</para> + </td> + <td> + <para style="terp_default_Centre_8">[[ o.ref ]]</para> + </td> + </tr> + </blockTable> + <para style="terp_default_8"> <font color="white"> </font> </para> - <blockTable colWidths="63.0,224.0,72.0,58.0,43.0,62.0" style="Table2"> + <para style="terp_default_8"> + <font color="white"> </font> + </para> + <blockTable colWidths="63.0,224.0,72.0,58.0,43.0,62.0" style="Table_employee_detail_header"> <tr> <td> <para style="terp_tblheader_Details">Date</para> @@ -185,82 +186,62 @@ <tr> <td> <para style="terp_default_8">[[ repeatIn(o.line_ids,'line') ]]</para> - <blockTable colWidths="61.0,224.0,72.0,58.0,43.0,34.0,24.0" style="Table3"> + <blockTable colWidths="61.0,224.0,72.0,58.0,43.0,34.0,24.0" style="Table_employee_detail_content"> <tr> <td> - <para style="P6">[[ time.strftime('%d/%m/%Y', time.strptime(line.date_value, '%Y-%m-%d')) or '' ]]</para> + <para style="terp_default_9">[[ time.strftime('%d/%m/%Y', time.strptime(line.date_value, '%Y-%m-%d')) or '' ]]</para> </td> <td> - <para style="terp_default_9">[[ line.name or '' ]][[ line.description or '' ]]</para> + <para style="terp_default_9">[[ line.name or '' ]] [[ line.description or '' ]]</para> </td> <td> <para style="terp_default_Centre_9">[[ line.ref or '' ]]</para> - <blockTable colWidths="33.0,33.0" style="Table5"> - <tr> - <td> - <para style="P7"> - <font color="white"> </font> - </para> - </td> - <td> - <para style="P7"> - <font color="white"> </font> - </para> - </td> - </tr> - </blockTable> - <para style="terp_default_Centre_9"> - <font color="white"> </font> - </para> </td> <td> - <para style="terp_default_Right_9">[[ '%.2f' % line.unit_amount or '' ]]</para> + <para style="terp_default_Right_9">[[ '%.2f' % line.unit_amount or '' ]]</para> </td> <td> - <para style="terp_default_9">[[ '%.2f' % line.unit_quantity or '' ]]</para> + <para style="terp_default_Centre_9">[[ '%.2f' % line.unit_quantity or '' ]]</para> </td> <td> - <para style="terp_default_Right_9">[[ '%.2f' % line.total_amount or '' ]]</para> + <para style="terp_default_Right_9">[[ '%.2f' % line.total_amount or '' ]] </para> </td> <td> - <para style="terp_default_Right_9">[[ company.currency_id.name ]]</para> + <para style="terp_default_Right_9">[[ company.currency_id.name ]]</para> </td> </tr> </blockTable> </td> </tr> </blockTable> - <blockTable colWidths="418.0,43.0,39.0,23.0" style="Table4"> + <blockTable colWidths="418.0,43.0,39.0,23.0" style="Table_employee_total"> <tr> <td> - <para style="P5"> + <para style="terp_default_8"> <font color="white"> </font> </para> </td> <td> - <para style="terp_default_Bold_9">Total:</para> + <para style="terp_tblheader_Details">Total:</para> </td> <td> - <para style="terp_default_9_bold_right">[[ '%.2f' % o.amount ]]</para> + <para style="terp_default_9_bold_right">[[ '%.2f' % o.amount ]]</para> </td> <td> <para style="terp_default_9_bold_right">[[ company.currency_id.name ]]</para> </td> </tr> </blockTable> - <para style="terp_default_8"> - <font color="white"> </font> - </para> - <para style="P4">[[ o.note or '' ]][[ setTag('para','xpre') ]]</para> + <para style="terp_default_9">[[ o.note or '' ]] [[ setTag('para','xpre') ]]</para> <para style="terp_default_8"> <font color="white"> </font> </para> <para style="terp_default_9">Certified honest and conform,</para> <para style="terp_default_9">(Date and signature)</para> - <para style="terp_default_9"> + <para style="terp_default_8"> <font color="white"> </font> </para> - <para style="terp_default_9"> + <para style="terp_default_8"> <font color="white"> </font> </para> <para style="terp_default_9">This document must be dated and signed for reimbursment</para> diff --git a/addons/hr_timesheet/__terp__.py b/addons/hr_timesheet/__terp__.py index 0812a3578a9..1004f06d903 100644 --- a/addons/hr_timesheet/__terp__.py +++ b/addons/hr_timesheet/__terp__.py @@ -43,7 +43,7 @@ Lots of reporting on time and employee tracking are provided. It is completly integrated with the cost accounting module. It allows you to set up a management by affair. """, - "depends" : ["account", "hr", "base",], + "depends" : ["account", "hr", "base", "hr_attendance"], "init_xml" : ["hr_timesheet_data.xml"], "demo_xml" : ["hr_timesheet_demo.xml",], "update_xml" : [ diff --git a/addons/hr_timesheet/hr_timesheet_report.xml b/addons/hr_timesheet/hr_timesheet_report.xml index f1798cba4ce..eae167002a4 100644 --- a/addons/hr_timesheet/hr_timesheet_report.xml +++ b/addons/hr_timesheet/hr_timesheet_report.xml @@ -1,6 +1,7 @@ <?xml version="1.0" encoding="utf-8"?> <openerp> <data> + <menuitem id="hr.menu_hr_reporting" name="Reporting" parent="hr.menu_hr_root" sequence="40"/> <report auto="False" id="report_user_timesheet" menu="False" model="hr.employee" name="hr.analytical.timesheet" string="Employee timesheet" xsl="hr_timesheet/report/user_timesheet.xsl"/> <wizard id="wizard_hr_timesheet" menu="False" model="hr.employee" name="hr.analytical.timesheet" string="Employee timesheet"/> diff --git a/addons/hr_timesheet/hr_timesheet_wizard.xml b/addons/hr_timesheet/hr_timesheet_wizard.xml index e0364f0204b..d78c617e9dc 100644 --- a/addons/hr_timesheet/hr_timesheet_wizard.xml +++ b/addons/hr_timesheet/hr_timesheet_wizard.xml @@ -2,7 +2,7 @@ <openerp> <data> <wizard id="si_so" model="hr.employee" name="hr_timesheet.si_so" string="Sign in / Sign out by project"/> - <menuitem action="si_so" id="menu_si_so" parent="hr.menu_hr_attendance" type="wizard"/> + <menuitem action="si_so" id="menu_si_so" parent="hr_attendance.menu_hr_attendance" type="wizard"/> </data> </openerp> diff --git a/addons/hr_timesheet_invoice/hr_timesheet_invoice_view.xml b/addons/hr_timesheet_invoice/hr_timesheet_invoice_view.xml index d2bd328cb55..e5a29a08eb4 100644 --- a/addons/hr_timesheet_invoice/hr_timesheet_invoice_view.xml +++ b/addons/hr_timesheet_invoice/hr_timesheet_invoice_view.xml @@ -1,6 +1,7 @@ <?xml version="1.0" encoding="utf-8"?> <openerp> <data> + <menuitem id="hr.menu_hr_reporting" name="Reporting" parent="hr.menu_hr_root" sequence="40"/> <record id="account_analytic_account_form_form" model="ir.ui.view"> <field name="name">account.analytic.account.invoice.form</field> <field name="model">account.analytic.account</field> diff --git a/addons/hr_timesheet_invoice/report/cost_ledger.rml b/addons/hr_timesheet_invoice/report/cost_ledger.rml index ed555887315..607d709546b 100644 --- a/addons/hr_timesheet_invoice/report/cost_ledger.rml +++ b/addons/hr_timesheet_invoice/report/cost_ledger.rml @@ -2,7 +2,7 @@ <document filename="test.pdf"> <template pageSize="(595.0,842.0)" title="Test" author="Martin Simon" allowSplitting="20"> <pageTemplate id="first"> - <frame id="first" x1="28.0" y1="28.0" width="539" height="786"/> + <frame id="first" x1="57.0" y1="57.0" width="481" height="728"/> </pageTemplate> </template> <stylesheet> @@ -10,80 +10,160 @@ <blockAlignment value="LEFT"/> <blockValign value="TOP"/> </blockTableStyle> - <blockTableStyle id="Tableau1"> + <blockTableStyle id="Table_main_header"> <blockAlignment value="LEFT"/> <blockValign value="TOP"/> - <blockBackground colorName="#e6e6e6" start="0,0" stop="0,0"/> - <blockBackground colorName="#e6e6e6" start="1,0" stop="1,0"/> - <blockBackground colorName="#e6e6e6" start="2,0" stop="2,0"/> - <blockBackground colorName="#e6e6e6" start="0,1" stop="0,1"/> - <blockBackground colorName="#e6e6e6" start="1,1" stop="1,1"/> - <blockBackground colorName="#e6e6e6" start="2,1" stop="2,1"/> + <blockBackground colorName="#ffffff" start="0,0" stop="0,-1"/> + <blockBackground colorName="#ffffff" start="1,0" stop="1,-1"/> + <blockBackground colorName="#ffffff" start="2,0" stop="2,-1"/> </blockTableStyle> - <blockTableStyle id="Tableau3"> + <blockTableStyle id="Table_period_date_header"> <blockAlignment value="LEFT"/> <blockValign value="TOP"/> - <lineStyle kind="GRID" colorName="black"/> + <lineStyle kind="LINEBEFORE" colorName="#e6e6e6" start="0,0" stop="0,-1"/> + <lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="0,0" stop="0,0"/> + <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="0,-1" stop="0,-1"/> + <lineStyle kind="LINEBEFORE" colorName="#e6e6e6" start="1,0" stop="1,-1"/> + <lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="1,0" stop="1,0"/> + <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="1,-1" stop="1,-1"/> + <lineStyle kind="LINEBEFORE" colorName="#e6e6e6" start="2,0" stop="2,-1"/> + <lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="2,0" stop="2,0"/> + <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="2,-1" stop="2,-1"/> + <lineStyle kind="LINEBEFORE" colorName="#e6e6e6" start="3,0" stop="3,-1"/> + <lineStyle kind="LINEAFTER" colorName="#e6e6e6" start="3,0" stop="3,-1"/> + <lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="3,0" stop="3,0"/> + <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="3,-1" stop="3,-1"/> </blockTableStyle> - <blockTableStyle id="Tableau2"> + <blockTableStyle id="Table_period_date_content"> <blockAlignment value="LEFT"/> <blockValign value="TOP"/> - <blockBackground colorName="#e6e6e6" start="0,0" stop="0,0"/> + <lineStyle kind="LINEBEFORE" colorName="#e6e6e6" start="0,0" stop="0,-1"/> + <lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="0,0" stop="0,0"/> + <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="0,-1" stop="0,-1"/> + <lineStyle kind="LINEBEFORE" colorName="#e6e6e6" start="1,0" stop="1,-1"/> + <lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="1,0" stop="1,0"/> + <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="1,-1" stop="1,-1"/> + <lineStyle kind="LINEBEFORE" colorName="#e6e6e6" start="2,0" stop="2,-1"/> + <lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="2,0" stop="2,0"/> + <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="2,-1" stop="2,-1"/> + <lineStyle kind="LINEBEFORE" colorName="#e6e6e6" start="3,0" stop="3,-1"/> + <lineStyle kind="LINEAFTER" colorName="#e6e6e6" start="3,0" stop="3,-1"/> + <lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="3,0" stop="3,0"/> + <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="3,-1" stop="3,-1"/> </blockTableStyle> - <blockTableStyle id="Tableau4"> + <blockTableStyle id="Table_account_detail_header"> <blockAlignment value="LEFT"/> <blockValign value="TOP"/> + <lineStyle kind="LINEBELOW" colorName="#000000" start="0,-1" stop="0,-1"/> + <lineStyle kind="LINEBELOW" colorName="#000000" start="1,-1" stop="1,-1"/> + <lineStyle kind="LINEBELOW" colorName="#000000" start="2,-1" stop="2,-1"/> + <lineStyle kind="LINEBELOW" colorName="#000000" start="3,-1" stop="3,-1"/> + <lineStyle kind="LINEBELOW" colorName="#000000" start="4,-1" stop="4,-1"/> + <lineStyle kind="LINEBELOW" colorName="#000000" start="5,-1" stop="5,-1"/> + <lineStyle kind="LINEBELOW" colorName="#000000" start="6,-1" stop="6,-1"/> </blockTableStyle> - <blockTableStyle id="Tableau7"> + <blockTableStyle id="Table_account_code_name"> <blockAlignment value="LEFT"/> <blockValign value="TOP"/> + <blockBackground colorName="#ffffff" start="0,0" stop="0,-1"/> </blockTableStyle> - <blockTableStyle id="Tableau6"> + <blockTableStyle id="Table1"> <blockAlignment value="LEFT"/> <blockValign value="TOP"/> + <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="2,-1" stop="2,-1"/> + <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="3,-1" stop="3,-1"/> + <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="4,-1" stop="4,-1"/> + <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="5,-1" stop="5,-1"/> + <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="6,-1" stop="6,-1"/> + <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="7,-1" stop="7,-1"/> + <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="8,-1" stop="8,-1"/> + <lineStyle kind="LINEABOVE" colorName="#ffffff" start="9,0" stop="9,0"/> + <lineStyle kind="LINEBELOW" colorName="#ffffff" start="9,-1" stop="9,-1"/> + <lineStyle kind="LINEABOVE" colorName="#ffffff" start="10,0" stop="10,0"/> + <lineStyle kind="LINEBELOW" colorName="#ffffff" start="10,-1" stop="10,-1"/> + <lineStyle kind="LINEABOVE" colorName="#ffffff" start="11,0" stop="11,0"/> + <lineStyle kind="LINEBELOW" colorName="#ffffff" start="11,-1" stop="11,-1"/> + <lineStyle kind="LINEABOVE" colorName="#ffffff" start="12,0" stop="12,0"/> + <lineStyle kind="LINEBELOW" colorName="#ffffff" start="12,-1" stop="12,-1"/> + <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="1,-1" stop="1,-1"/> + <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="2,-1" stop="2,-1"/> + <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="3,-1" stop="3,-1"/> + <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="4,-1" stop="4,-1"/> + <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="5,-1" stop="5,-1"/> + <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="6,-1" stop="6,-1"/> + <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="7,-1" stop="7,-1"/> + <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="0,-1" stop="0,-1"/> + <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="1,-1" stop="1,-1"/> + <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="2,-1" stop="2,-1"/> + <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="3,-1" stop="3,-1"/> + <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="4,-1" stop="4,-1"/> + <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="5,-1" stop="5,-1"/> + <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="6,-1" stop="6,-1"/> + <lineStyle kind="LINEABOVE" colorName="#ffffff" start="0,3" stop="0,3"/> + <lineStyle kind="LINEBELOW" colorName="#ffffff" start="0,-1" stop="0,-1"/> + <lineStyle kind="LINEABOVE" colorName="#ffffff" start="1,3" stop="1,3"/> + <lineStyle kind="LINEBELOW" colorName="#ffffff" start="1,-1" stop="1,-1"/> + <lineStyle kind="LINEABOVE" colorName="#ffffff" start="2,3" stop="2,3"/> + <lineStyle kind="LINEBELOW" colorName="#ffffff" start="2,-1" stop="2,-1"/> + <lineStyle kind="LINEABOVE" colorName="#ffffff" start="3,3" stop="3,3"/> + <lineStyle kind="LINEBELOW" colorName="#ffffff" start="3,-1" stop="3,-1"/> </blockTableStyle> - <blockTableStyle id="Tableau5"> + <blockTableStyle id="Table4"> <blockAlignment value="LEFT"/> <blockValign value="TOP"/> - <blockBackground colorName="#e6e6e6" start="0,0" stop="0,0"/> - <blockBackground colorName="#e6e6e6" start="1,0" stop="1,0"/> - <blockBackground colorName="#e6e6e6" start="2,0" stop="2,0"/> - <blockBackground colorName="#e6e6e6" start="3,0" stop="3,0"/> - <blockBackground colorName="#e6e6e6" start="4,0" stop="4,0"/> - <blockBackground colorName="#e6e6e6" start="5,0" stop="5,0"/> + <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="1,-1" stop="1,-1"/> + <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="2,-1" stop="2,-1"/> + <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="3,-1" stop="3,-1"/> + <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="4,-1" stop="4,-1"/> + <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="5,-1" stop="5,-1"/> + <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="6,-1" stop="6,-1"/> + <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="7,-1" stop="7,-1"/> + <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="0,-1" stop="0,-1"/> + <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="1,-1" stop="1,-1"/> + <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="2,-1" stop="2,-1"/> + <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="3,-1" stop="3,-1"/> + <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="4,-1" stop="4,-1"/> + <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="5,-1" stop="5,-1"/> + <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="6,-1" stop="6,-1"/> </blockTableStyle> - <blockTableStyle id="Tableau10"> + <blockTableStyle id="Table_move_content"> + <blockAlignment value="LEFT"/> + <blockValign value="TOP"/> + <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="0,-1" stop="0,-1"/> + <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="1,-1" stop="1,-1"/> + <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="2,-1" stop="2,-1"/> + <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="3,-1" stop="3,-1"/> + <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="4,-1" stop="4,-1"/> + <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="5,-1" stop="5,-1"/> + <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="6,-1" stop="6,-1"/> + </blockTableStyle> + <blockTableStyle id="Table_move_repeat"> + <blockAlignment value="LEFT"/> + <blockValign value="TOP"/> + <lineStyle kind="LINEABOVE" colorName="#ffffff" start="0,0" stop="0,0"/> + <lineStyle kind="LINEBELOW" colorName="#ffffff" start="0,-1" stop="0,-1"/> + <lineStyle kind="LINEABOVE" colorName="#ffffff" start="1,0" stop="1,0"/> + <lineStyle kind="LINEBELOW" colorName="#ffffff" start="1,-1" stop="1,-1"/> + <lineStyle kind="LINEABOVE" colorName="#ffffff" start="2,0" stop="2,0"/> + <lineStyle kind="LINEBELOW" colorName="#ffffff" start="2,-1" stop="2,-1"/> + <lineStyle kind="LINEABOVE" colorName="#ffffff" start="3,0" stop="3,0"/> + <lineStyle kind="LINEBELOW" colorName="#ffffff" start="3,-1" stop="3,-1"/> + </blockTableStyle> + <blockTableStyle id="Table_account_code_total"> + <blockAlignment value="LEFT"/> + <blockValign value="TOP"/> + <blockBackground colorName="#ffffff" start="0,0" stop="0,-1"/> + <blockBackground colorName="#ffffff" start="1,0" stop="1,-1"/> + <blockBackground colorName="#ffffff" start="2,0" stop="2,-1"/> + <blockBackground colorName="#ffffff" start="3,0" stop="3,-1"/> + </blockTableStyle> + <blockTableStyle id="Table_account_total"> <blockAlignment value="LEFT"/> <blockValign value="TOP"/> - <lineStyle kind="GRID" colorName="black"/> </blockTableStyle> <initialize> <paraStyle name="all" alignment="justify"/> </initialize> - <paraStyle name="P1" fontName="Times-Roman" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="P2" fontName="Times-Bold" fontSize="20.0" leading="25" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="P3" fontName="Times-Bold" fontSize="10.0" leading="13" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="P4" fontName="Times-Bold" fontSize="10.0" leading="13" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="P5" fontName="Times-Bold" fontSize="10.0" leading="13" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="P6" fontName="Times-Roman" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="P7" fontName="Times-Roman" fontSize="8.0" leading="10" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="P8" fontName="Times-Bold" fontSize="8.0" leading="10" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="P9" fontName="Times-Bold" fontSize="8.0" leading="10" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="P10" fontName="Times-Bold" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="P11" fontName="Times-Roman"/> - <paraStyle name="P12" fontName="Times-Roman" fontSize="9.0" leading="11" alignment="CENTER"/> - <paraStyle name="P13" fontName="Times-Roman" fontSize="3.0" leading="4" alignment="LEFT"/> - <paraStyle name="P14" fontName="Times-Roman" fontSize="8.0" leading="10" alignment="LEFT"/> - <paraStyle name="P15" fontName="Times-Roman" fontSize="6.0" leading="8" alignment="LEFT"/> - <paraStyle name="P16" fontName="Times-Roman" fontSize="12.0" leading="15" alignment="CENTER"/> - <paraStyle name="P17" fontName="Times-Roman" fontSize="8.0" leading="10" alignment="LEFT"/> - <paraStyle name="P18" fontName="Times-Roman" fontSize="10.0" leading="13" alignment="LEFT"/> - <paraStyle name="P19" fontName="Times-Roman" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="P20" fontName="Times-Bold" fontSize="10.0" leading="13" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="P21" fontName="Times-Roman" fontSize="10.0" leading="13" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="P22" fontName="Times-Roman" fontSize="10.0" leading="13" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="P23" fontName="Times-Bold" fontSize="8.0" leading="10" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/> - <paraStyle name="P24" fontName="Times-Bold" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/> <paraStyle name="Standard" fontName="Times-Roman"/> <paraStyle name="Text body" fontName="Times-Roman" spaceBefore="0.0" spaceAfter="6.0"/> <paraStyle name="List" fontName="Times-Roman" spaceBefore="0.0" spaceAfter="6.0"/> @@ -91,216 +171,234 @@ <paraStyle name="Table Heading" fontName="Times-Roman" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/> <paraStyle name="Caption" fontName="Times-Roman" fontSize="10.0" leading="13" spaceBefore="6.0" spaceAfter="6.0"/> <paraStyle name="Index" fontName="Times-Roman"/> + <paraStyle name="Heading" fontName="Helvetica" fontSize="15.0" leading="19" spaceBefore="12.0" spaceAfter="6.0"/> + <paraStyle name="Footer" fontName="Times-Roman"/> + <paraStyle name="Horizontal Line" fontName="Times-Roman" fontSize="6.0" leading="8" spaceBefore="0.0" spaceAfter="14.0"/> + <paraStyle name="terp_header" fontName="Helvetica-Bold" fontSize="15.0" leading="19" alignment="LEFT" spaceBefore="12.0" spaceAfter="6.0"/> + <paraStyle name="Heading 9" fontName="Helvetica-Bold" fontSize="75%" leading="NaN" spaceBefore="12.0" spaceAfter="6.0"/> + <paraStyle name="terp_tblheader_General" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="6.0" spaceAfter="6.0"/> + <paraStyle name="terp_tblheader_Details" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="6.0" spaceAfter="6.0"/> + <paraStyle name="terp_default_8" fontName="Helvetica" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/> + <paraStyle name="terp_default_Bold_8" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/> + <paraStyle name="terp_tblheader_General_Centre" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="CENTER" spaceBefore="6.0" spaceAfter="6.0"/> + <paraStyle name="terp_tblheader_General_Right" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="RIGHT" spaceBefore="6.0" spaceAfter="6.0"/> + <paraStyle name="terp_tblheader_Details_Centre" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="CENTER" spaceBefore="6.0" spaceAfter="6.0"/> + <paraStyle name="terp_tblheader_Details_Right" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="6.0" spaceAfter="6.0"/> + <paraStyle name="terp_default_Right_8" fontName="Helvetica" fontSize="8.0" leading="10" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/> + <paraStyle name="terp_default_Centre_8" fontName="Helvetica" fontSize="8.0" leading="10" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/> + <paraStyle name="terp_header_Right" fontName="Helvetica-Bold" fontSize="15.0" leading="19" alignment="LEFT" spaceBefore="12.0" spaceAfter="6.0"/> + <paraStyle name="terp_header_Centre" fontName="Helvetica-Bold" fontSize="15.0" leading="19" alignment="CENTER" spaceBefore="12.0" spaceAfter="6.0"/> + <paraStyle name="terp_default_address" fontName="Helvetica" fontSize="10.0" leading="13" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/> + <paraStyle name="terp_default_9" fontName="Helvetica" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/> + <paraStyle name="terp_default_Bold_9" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/> + <paraStyle name="terp_default_Centre_9" fontName="Helvetica" fontSize="9.0" leading="11" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/> + <paraStyle name="terp_default_Right_9" fontName="Helvetica" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/> + <paraStyle name="terp_default_bold_right_9" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/> + <paraStyle name="terp_default_bold_8_20" rightIndent="0.0" leftIndent="-6.0" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/> + <paraStyle name="terp_default_bold_9_20" rightIndent="0.0" leftIndent="-6.0" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/> + <paraStyle name="terp_default_bold_9_10" rightIndent="0.0" leftIndent="-3.0" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/> + <paraStyle name="terp_default_bold_8_10" rightIndent="0.0" leftIndent="-3.0" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/> </stylesheet> + <images/> <story> - <blockTable colWidths="179.0,179.0,179.0" repeatRows="1" style="Tableau1"> + <blockTable colWidths="161.0,161.0,161.0" repeatRows="1" style="Table_main_header"> <tr> <td> - <para style="P1"> - <font color="white"> </font> - </para> + <para style="terp_default_8">[[ company.name ]]</para> </td> <td> - <para style="P2">Cost Ledger</para> + <para style="terp_header_Centre">Cost Ledger</para> </td> <td> - <para style="P21"> + <para style="terp_default_8"> <font color="white"> </font> </para> + <para style="terp_default_8"> + <font color="white"> </font> + </para> + </td> + </tr> + </blockTable> + <para style="terp_default_8"> + <font color="white"> </font> + </para> + <para style="terp_default_8"> + <font color="white"> </font> + </para> + <blockTable colWidths="120.0,120.0,120.0,121.0" style="Table_period_date_header"> + <tr> + <td> + <para style="terp_tblheader_General_Centre">Period from startdate</para> + </td> + <td> + <para style="terp_tblheader_General_Centre">Period to enddate</para> + </td> + <td> + <para style="terp_tblheader_General_Centre">Currency</para> + </td> + <td> + <para style="terp_tblheader_General_Centre">Printing date</para> </td> </tr> + </blockTable> + <blockTable colWidths="120.0,120.0,120.0,121.0" style="Table_period_date_content"> <tr> <td> - <para style="P1">[[ company.name ]]</para> + <para style="terp_default_Centre_8">[[ data['form']['date1'] ]]</para> </td> <td> - <para style="P22">Period from [[ data['form']['date1'] ]]</para> - <para style="P22">to [[ data['form']['date2'] ]]</para> + <para style="terp_default_Centre_8">[[ data['form']['date2'] ]]</para> </td> <td> - <para style="P21">Currency: [[ company.currency_id.name ]]</para> + <para style="terp_default_Centre_8">[[ company.currency_id.name ]]</para> + </td> + <td> + <para style="terp_default_Centre_8">[[ time.strftime('%Y-%m-%d') ]] at [[ time.strftime('%H:%M:%S') ]]</para> </td> </tr> </blockTable> - <para style="P11"> + <para style="terp_default_8"> <font color="white"> </font> </para> - <para style="P12">Printing date: [[ time.strftime('%Y-%m-%d') ]] at [[ time.strftime('%H:%M:%S') ]]</para> - <para style="P12"> + <para style="terp_default_Centre_8"> <font color="white"> </font> </para> - <blockTable colWidths="63.0,46.0,139.0,54.0,55.0,55.0,63.0,63.0" style="Tableau3"> + <blockTable colWidths="54.0,29.0,42.0,184.0,57.0,57.0,57.0" style="Table_account_detail_header"> <tr> <td> - <para style="P4">Date</para> + <para style="terp_tblheader_Details_Centre">Date</para> </td> <td> - <para style="P4">J.C.</para> + <para style="terp_tblheader_Details_Centre">J.C.</para> </td> <td> - <para style="P4">Move name</para> + <para style="terp_tblheader_Details_Centre">Code</para> </td> <td> - <para style="P4">Qty</para> + <para style="terp_tblheader_Details_Centre">Move name</para> </td> <td> - <para style="P4">Debit </para> + <para style="terp_tblheader_Details_Right">Debit </para> </td> <td> - <para style="P4">Credit</para> + <para style="terp_tblheader_Details_Right">Credit</para> </td> <td> - <para style="P4">Balance</para> - </td> - <td> - <para style="P4">Theorical Revenue</para> + <para style="terp_tblheader_Details_Right">Balance</para> </td> </tr> </blockTable> - <para style="P13"> + <para style="terp_default_8"> <font color="white"> </font> </para> + <para style="terp_default_8">[[ repeatIn(objects,'o') ]]</para> <section> - <para style="P14">[[ repeatIn(objects, 'o') ]]</para> - <para style="P15"> - <font color="white"> </font> - </para> - <blockTable colWidths="539.0" style="Tableau2"> + <blockTable colWidths="481.0" style="Table_account_code_name"> <tr> <td> - <para style="P17"><font face="Times-Roman" size="8.0">[[ o.code ]] [[ o.name ]]: </font>max qty: [[ o.quantity_max or '-' ]], max amount: [[ o.amount_max or '-']]</para> + <para style="terp_default_bold_9_20">[[ o.code ]] [[ o.complete_name ]]</para> </td> </tr> </blockTable> - <para style="P13"> + <para style="terp_default_8"> <font color="white"> </font> </para> <section> - <para style="P15">[[ repeatIn(lines_g(o.id, data['form']['date1'], data['form']['date2']), 'move_g') ]]</para> - <para style="P13"> - <font color="white"> </font> - </para> - <blockTable colWidths="475.0,63.0" style="Tableau4"> + <blockTable colWidths="482.0" style="Table1"> <tr> <td> - <para style="P5">[[ move_g['code'] ]] <font face="Times-Bold" size="10.0">[[ move_g['name'] ]]</font></para> - </td> - <td> - <para style="P3"> - <font color="white"> </font> - </para> + <para style="terp_default_8">[[ repeatIn(lines_g(o.id,data['form']['date1'],data['form']['date2']),'move_g') ]]</para> + <blockTable colWidths="471.0" style="Table4"> + <tr> + <td> + <para style="terp_default_bold_8_10">[[ move_g['code'] ]] [[ move_g['name'] ]]</para> + <para style="terp_default_8"> + <font color="white"> </font> + </para> + <blockTable colWidths="38.0,34.0,41.0,192.0,51.0,57.0,54.0" style="Table_move_content"> + <tr> + <td> + <para style="terp_default_Centre_9">[[ repeatIn(lines_a(move_g['id'],o.id,data['form']['date1'],data['form']['date2']),'move_a') ]]</para> + <para style="terp_default_Centre_9">[[ move_a['date'] ]]</para> + </td> + <td> + <para style="terp_default_Centre_9">[[ move_a['cj'] ]]</para> + </td> + <td> + <para style="terp_default_Centre_9">[[ move_a['code'] ]]</para> + </td> + <td> + <para style="terp_default_Centre_9">[[ move_a['name'] ]]</para> + </td> + <td> + <para style="terp_default_Right_9">[[ '%.2f' % move_a['debit'] ]]</para> + </td> + <td> + <para style="terp_default_Right_9">[[ '%.2f' % move_a['credit'] ]]</para> + </td> + <td> + <para style="terp_default_Right_9">[[ '%.2f' % move_a['balance'] ]]</para> + </td> + </tr> + </blockTable> + </td> + </tr> + </blockTable> + <blockTable colWidths="310.0,52.0,57.0,57.0" style="Table_move_repeat"> + <tr> + <td> + <para style="terp_default_bold_9_10">Total ([[ move_g['code'] ]])</para> + </td> + <td> + <para style="terp_default_bold_right_9">[[ '%.2f' % move_g['debit'] ]]</para> + </td> + <td> + <para style="terp_default_bold_right_9">[[ '%.2f' % move_g['credit'] ]]</para> + </td> + <td> + <para style="terp_default_bold_right_9">[[ '%.2f' % move_g['balance'] ]]</para> + </td> + </tr> + </blockTable> </td> </tr> </blockTable> - <blockTable colWidths="63.0,46.0,139.0,55.0,53.0,57.0,63.0,63.0" style="Tableau7"> - <tr> - <td> - <para style="P6">[[ repeatIn(lines_a(move_g['id'], o.id, data['form']['date1'], data['form']['date2']), 'move_a') ]]</para> - <para style="P6">[[ move_a['date'] ]]</para> - </td> - <td> - <para style="P7">[[ move_a['cj'] ]]</para> - </td> - <td> - <para style="P6">[[ move_a['name'] ]]</para> - </td> - <td> - <para style="P7">[[ '%.2f' % move_a['quantity'] ]]</para> - </td> - <td> - <para style="P7">[[ '%.2f' % move_a['debit'] ]]</para> - </td> - <td> - <para style="P7">[[ '%.2f' % move_a['credit'] ]]</para> - </td> - <td> - <para style="P7">[[ '%.2f' % move_a['balance'] ]]</para> - </td> - <td> - <para style="P7">[[ '%.2f' % move_a['revenue'] ]]</para> - </td> - </tr> - </blockTable> - <blockTable colWidths="247.0,55.0,53.0,57.0,63.0,63.0" style="Tableau6"> - <tr> - <td> - <para style="P8">Total ([[ move_g['name'] ]])</para> - </td> - <td> - <para style="P8">[[ '%.2f' % move_g['quantity'] ]]</para> - </td> - <td> - <para style="P8">[[ '%.2f' % move_g['debit'] ]]</para> - </td> - <td> - <para style="P8">[[ '%.2f' % move_g['credit'] ]]</para> - </td> - <td> - <para style="P8">[[ '%.2f' % move_g['balance'] ]]</para> - </td> - <td> - <para style="P8">[[ '%.2f' % (account_g_sum_revenue(move_g['id']) or 0.0) ]]</para> - </td> - </tr> - </blockTable> - <para style="P13"> - <font color="white"> </font> - </para> </section> - <blockTable colWidths="247.0,55.0,53.0,56.0,63.0,63.0" style="Tableau5"> + <blockTable colWidths="312.0,57.0,57.0,56.0" style="Table_account_code_total"> <tr> <td> - <para style="P24">Total ([[ o['code'] ]])</para> - </td> - <td> - <para style="P10">[[ '%.2f' % (account_sum_qty(o.id, data['form']['date1'], data['form']['date2']) or 0.0) ]]</para> + <para style="terp_default_bold_9_10">Total ([[ o.code ]])</para> </td> <td> - <para style="P10">[[ '%.2f' % (account_sum_debit(o.id, data['form']['date1'], data['form']['date2']) or 0.0) ]]</para> + <para style="terp_default_bold_right_9">[[ '%.2f' % (account_sum_debit(o.id,data['form']['date1'],data['form']['date2']) or 0.0) ]]</para> </td> <td> - <para style="P10">[[ '%.2f' % (account_sum_credit(o.id, data['form']['date1'], data['form']['date2']) or 0.0) ]]</para> + <para style="terp_default_bold_right_9">[[ '%.2f' % (account_sum_credit(o.id,data['form']['date1'],data['form']['date2']) or 0.0) ]]</para> </td> <td> - <para style="P10">[[ '%.2f' % (account_sum_balance(o.id, data['form']['date1'], data['form']['date2']) or 0.0) ]]</para> - </td> - <td> - <para style="P10">[[ '%.2f' % (account_sum_revenue(o.id) or 0.0) ]]</para> + <para style="terp_default_bold_right_9">[[ '%.2f' % (account_sum_balance(o.id,data['form']['date1'],data['form']['date2']) or 0.0)]]</para> </td> </tr> </blockTable> - <para style="P15"> - <font color="white"> </font> - </para> </section> - <para style="P16"> - <font color="white"> </font> - </para> - <blockTable colWidths="247.0,55.0,53.0,56.0,63.0,64.0" style="Tableau10"> + <blockTable colWidths="311.0,59.0,56.0,57.0" style="Table_account_total"> <tr> <td> - <para style="P9">Total</para> - </td> - <td> - <para style="P9">[[ '%.2f' % (sum_qty(objects, data['form']['date1'], data['form']['date2']) or 0.0) ]]</para> - </td> - <td> - <para style="P9">[[ '%.2f' % (sum_debit(objects, data['form']['date1'], data['form']['date2']) or 0.0) ]]</para> + <para style="terp_default_bold_9_10">Total</para> </td> <td> - <para style="P9">[[ '%.2f' % (sum_credit(objects, data['form']['date1'], data['form']['date2']) or 0.0) ]]</para> + <para style="terp_default_bold_right_9">[[ '%.2f' % (sum_debit(objects,data['form']['date1'],data['form']['date2']) or 0.0) ]]</para> </td> <td> - <para style="P9">[[ '%.2f' % (sum_balance(objects, data['form']['date1'], data['form']['date2']) or 0.0) ]]</para> + <para style="terp_default_bold_right_9">[[ '%.2f' % (sum_credit(objects,data['form']['date1'],data['form']['date2']) or 0.0) ]]</para> </td> <td> - <para style="P9">[[ '%.2f' % (sum_revenue(objects) or 0.0) ]]</para> + <para style="terp_default_bold_right_9">[[ '%.2f' % (sum_balance(objects,data['form']['date1'],data['form']['date2']) or 0.0) ]]</para> </td> </tr> </blockTable> - <para style="P18"> + <para style="terp_default_8"> <font color="white"> </font> </para> </story> -</document> - +</document>
\ No newline at end of file diff --git a/addons/hr_timesheet_sheet/hr_timesheet_sheet_demo.xml b/addons/hr_timesheet_sheet/hr_timesheet_sheet_demo.xml index 4b707196d37..c687b171640 100644 --- a/addons/hr_timesheet_sheet/hr_timesheet_sheet_demo.xml +++ b/addons/hr_timesheet_sheet/hr_timesheet_sheet_demo.xml @@ -19,7 +19,7 @@ <field eval="time.strftime('%Y-%m-%d')" name="date_current"/> </record> - <record id="hr.attendance1" model="hr.attendance"> + <!-- <record id="hr.attendance1" model="hr.attendance"> <field name="sheet_id" ref="sheet1"/> </record> <record id="hr.attendance2" model="hr.attendance"> @@ -78,7 +78,7 @@ </record> <record id="hr.attendance20" model="hr.attendance"> <field name="sheet_id" ref="sheet1"/> - </record> + </record> --> <record id="hr_timesheet.analytic_timesheet1" model="hr.analytic.timesheet"> <field name="sheet_id" ref="sheet1"/> diff --git a/addons/hr_timesheet_sheet/hr_timesheet_sheet_view.xml b/addons/hr_timesheet_sheet/hr_timesheet_sheet_view.xml index ab654cad9b7..00b01f46ed2 100644 --- a/addons/hr_timesheet_sheet/hr_timesheet_sheet_view.xml +++ b/addons/hr_timesheet_sheet/hr_timesheet_sheet_view.xml @@ -279,7 +279,7 @@ <field name="name">hr.attendance.form</field> <field name="model">hr.attendance</field> <field name="type">form</field> - <field name="inherit_id" ref="hr.view_attendance_form"/> + <field name="inherit_id" ref="hr_attendance.view_attendance_form"/> <field name="arch" type="xml"> <field name="action_desc" position="after"> <field name="sheet_id" select="2"/> @@ -290,7 +290,7 @@ <field name="name">hr.attendance.tree</field> <field name="model">hr.attendance</field> <field name="type">tree</field> - <field name="inherit_id" ref="hr.view_attendance_tree"/> + <field name="inherit_id" ref="hr_attendance.view_attendance_tree"/> <field name="arch" type="xml"> <field name="action_desc" position="after"> <field name="sheet_id"/> |
