[MERGE] optionnal attendances visible
bzr revid: fp@tinyerp.com-20120927174758-zp58w2phycwm30l7
This commit is contained in:
commit
816f50974a
|
@ -350,10 +350,8 @@
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<form string="Job" version="7.0">
|
<form string="Job" version="7.0">
|
||||||
<header>
|
<header>
|
||||||
<span groups="base.group_user">
|
<button name="job_recruitement" string="In Recruitement" states="open" type="object" class="oe_highlight" groups="base.group_user"/>
|
||||||
<button name="job_recruitement" string="In Recruitement" states="open" type="object" class="oe_highlight"/>
|
<button name="job_open" string="Recruitment Done" states="recruit" type="object" class="oe_highlight" groups="base.group_user"/>
|
||||||
<button name="job_open" string="Recruitment Done" states="recruit" type="object" class="oe_highlight"/>
|
|
||||||
</span>
|
|
||||||
<field name="state" widget="statusbar" statusbar_visible="recruit,open"/>
|
<field name="state" widget="statusbar" statusbar_visible="recruit,open"/>
|
||||||
</header>
|
</header>
|
||||||
<sheet>
|
<sheet>
|
||||||
|
|
|
@ -69,7 +69,7 @@
|
||||||
<field name="module_hr_timesheet_sheet" class="oe_inline"/>
|
<field name="module_hr_timesheet_sheet" class="oe_inline"/>
|
||||||
<label for="module_hr_timesheet_sheet"/>
|
<label for="module_hr_timesheet_sheet"/>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div name="hr_attendance">
|
||||||
<field name="module_hr_attendance" on_change="onchange_hr_attendance(module_hr_attendance)" class="oe_inline"/>
|
<field name="module_hr_attendance" on_change="onchange_hr_attendance(module_hr_attendance)" class="oe_inline"/>
|
||||||
<label for="module_hr_attendance"/>
|
<label for="module_hr_attendance"/>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -22,5 +22,6 @@
|
||||||
import hr_attendance
|
import hr_attendance
|
||||||
import wizard
|
import wizard
|
||||||
import report
|
import report
|
||||||
|
import res_config
|
||||||
|
|
||||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||||
|
|
|
@ -35,14 +35,14 @@ actions(Sign in/Sign out) performed by them.
|
||||||
'images': ['images/hr_attendances.jpeg'],
|
'images': ['images/hr_attendances.jpeg'],
|
||||||
'depends': ['hr'],
|
'depends': ['hr'],
|
||||||
'data': [
|
'data': [
|
||||||
|
'security/ir_rule.xml',
|
||||||
'security/ir.model.access.csv',
|
'security/ir.model.access.csv',
|
||||||
'hr_attendance_view.xml',
|
'hr_attendance_view.xml',
|
||||||
'hr_attendance_report.xml',
|
'hr_attendance_report.xml',
|
||||||
'security/ir.model.access.csv',
|
|
||||||
'security/ir_rule.xml',
|
|
||||||
'wizard/hr_attendance_bymonth_view.xml',
|
'wizard/hr_attendance_bymonth_view.xml',
|
||||||
'wizard/hr_attendance_byweek_view.xml',
|
'wizard/hr_attendance_byweek_view.xml',
|
||||||
'wizard/hr_attendance_error_view.xml',
|
'wizard/hr_attendance_error_view.xml',
|
||||||
|
'res_config_view.xml',
|
||||||
],
|
],
|
||||||
'demo': ['hr_attendance_demo.xml'],
|
'demo': ['hr_attendance_demo.xml'],
|
||||||
'test': [
|
'test': [
|
||||||
|
|
|
@ -126,9 +126,18 @@ class hr_employee(osv.osv):
|
||||||
result[id] = res[0]
|
result[id] = res[0]
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
def _attendance_access(self, cr, uid, ids, name, args, context=None):
|
||||||
|
# this function field use to hide attendance button to singin/singout from menu
|
||||||
|
group = self.pool.get('ir.model.data').get_object(cr, uid, 'base', 'group_hr_attendance')
|
||||||
|
visible = False
|
||||||
|
if uid in [user.id for user in group.users]:
|
||||||
|
visible = True
|
||||||
|
return dict([(x, visible) for x in ids])
|
||||||
|
|
||||||
_columns = {
|
_columns = {
|
||||||
'state': fields.function(_state, type='selection', selection=[('absent', 'Absent'), ('present', 'Present')], string='Attendance'),
|
'state': fields.function(_state, type='selection', selection=[('absent', 'Absent'), ('present', 'Present')], string='Attendance'),
|
||||||
'last_sign': fields.function(_last_sign, type='datetime', string='Last Sign'),
|
'last_sign': fields.function(_last_sign, type='datetime', string='Last Sign'),
|
||||||
|
'attendance_access': fields.function(_attendance_access, type='boolean'),
|
||||||
}
|
}
|
||||||
|
|
||||||
def _action_check(self, cr, uid, emp_id, dt=False, context=None):
|
def _action_check(self, cr, uid, emp_id, dt=False, context=None):
|
||||||
|
|
|
@ -76,9 +76,9 @@
|
||||||
|
|
||||||
<menuitem id="menu_hr_time_tracking" name="Time Tracking" parent="hr.menu_hr_root" sequence="5" groups="base.group_user,base.group_hr_user,base.group_hr_manager"/>
|
<menuitem id="menu_hr_time_tracking" name="Time Tracking" parent="hr.menu_hr_root" sequence="5" groups="base.group_user,base.group_hr_user,base.group_hr_manager"/>
|
||||||
|
|
||||||
<menuitem id="menu_hr_attendance" name="Attendances" parent="hr.menu_hr_root" sequence="10" groups="base.group_user,base.group_hr_user,base.group_hr_manager"/>
|
<menuitem id="menu_hr_attendance" name="Attendances" parent="hr.menu_hr_root" sequence="10" groups="base.group_hr_attendance"/>
|
||||||
|
|
||||||
<menuitem action="open_view_attendance" id="menu_open_view_attendance" parent="menu_hr_attendance" sequence="20"/>
|
<menuitem action="open_view_attendance" id="menu_open_view_attendance" parent="menu_hr_attendance" sequence="20" groups="base.group_hr_attendance"/>
|
||||||
|
|
||||||
<record id="edit_attendance_reason" model="ir.ui.view">
|
<record id="edit_attendance_reason" model="ir.ui.view">
|
||||||
<field name="name">hr.action.reason.form</field>
|
<field name="name">hr.action.reason.form</field>
|
||||||
|
@ -114,9 +114,8 @@
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
<menuitem
|
<menuitem
|
||||||
sequence="35" id="hr.menu_open_view_attendance_reason_new_config" parent="hr.menu_hr_configuration" name="Attendance"
|
sequence="35" id="hr.menu_open_view_attendance_reason_new_config" parent="hr.menu_hr_configuration" groups="base.group_hr_attendance" name="Attendance"/>
|
||||||
groups="base.group_no_one"/>
|
<menuitem action="open_view_attendance_reason" id="menu_open_view_attendance_reason" parent="hr.menu_open_view_attendance_reason_new_config" groups="base.group_hr_attendance"/>
|
||||||
<menuitem action="open_view_attendance_reason" id="menu_open_view_attendance_reason" parent="hr.menu_open_view_attendance_reason_new_config" groups="base.group_no_one"/>
|
|
||||||
|
|
||||||
<record id="hr_attendance_employee" model="ir.ui.view">
|
<record id="hr_attendance_employee" model="ir.ui.view">
|
||||||
<field name="name">hr.employee.form1</field>
|
<field name="name">hr.employee.form1</field>
|
||||||
|
@ -124,8 +123,8 @@
|
||||||
<field name="inherit_id" ref="hr.view_employee_form"/>
|
<field name="inherit_id" ref="hr.view_employee_form"/>
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<field name="active" position="before">
|
<field name="active" position="before">
|
||||||
<label for="state"/>
|
<label for="state" groups="base.group_hr_attendance"/>
|
||||||
<div>
|
<div groups="base.group_hr_attendance">
|
||||||
<field name="state" class="oe_inline"/> -
|
<field name="state" class="oe_inline"/> -
|
||||||
<button class="oe_link" name="attendance_action_change" states="present" string="Sign Out" type="object" context="{'type':'sign_out'}" groups="base.group_hr_user"/>
|
<button class="oe_link" name="attendance_action_change" states="present" string="Sign Out" type="object" context="{'type':'sign_out'}" groups="base.group_hr_user"/>
|
||||||
<button class="oe_link" name="attendance_action_change" states="absent" string="Sign In" type="object" context="{'type':'sign_in'}" groups="base.group_hr_user"/>
|
<button class="oe_link" name="attendance_action_change" states="absent" string="Sign In" type="object" context="{'type':'sign_in'}" groups="base.group_hr_user"/>
|
||||||
|
|
|
@ -0,0 +1,33 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
##############################################################################
|
||||||
|
#
|
||||||
|
# OpenERP, Open Source Business Applications
|
||||||
|
# Copyright (C) 2004-2012 OpenERP S.A. (<http://openerp.com>).
|
||||||
|
#
|
||||||
|
# This program is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU Affero General Public License as
|
||||||
|
# published by the Free Software Foundation, either version 3 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 Affero General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU Affero General Public License
|
||||||
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
#
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
from osv import fields, osv
|
||||||
|
|
||||||
|
class hr_attendance_config_settings(osv.osv_memory):
|
||||||
|
_inherit = 'hr.config.settings'
|
||||||
|
|
||||||
|
_columns = {
|
||||||
|
'group_hr_attendance': fields.boolean('Track attendances',
|
||||||
|
implied_group='base.group_hr_attendance',
|
||||||
|
help="Allocates attendance group to all users."),
|
||||||
|
}
|
||||||
|
|
||||||
|
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
|
@ -0,0 +1,20 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<openerp>
|
||||||
|
<data noupdate="1">
|
||||||
|
<record id="hr_attendace_group" model="ir.ui.view">
|
||||||
|
<field name="name">hr.config.settings.inherit</field>
|
||||||
|
<field name="model">hr.config.settings</field>
|
||||||
|
<field name="inherit_id" ref="hr.view_human_resources_configuration"/>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<data>
|
||||||
|
<xpath expr="//div[@name='hr_attendance']" position="after">
|
||||||
|
<div>
|
||||||
|
<field name="group_hr_attendance" class="oe_inline"/>
|
||||||
|
<label for="group_hr_attendance"/>
|
||||||
|
</div>
|
||||||
|
</xpath>
|
||||||
|
</data>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
</data>
|
||||||
|
</openerp>
|
|
@ -2,6 +2,12 @@
|
||||||
<openerp>
|
<openerp>
|
||||||
<data noupdate="True">
|
<data noupdate="True">
|
||||||
|
|
||||||
|
<record id="base.group_hr_attendance" model="res.groups">
|
||||||
|
<field name="name">Attendance</field>
|
||||||
|
<field name="category_id" ref="base.module_category_human_resources"/>
|
||||||
|
<field name="implied_ids" eval="[(4, ref('base.group_user'))]"/>
|
||||||
|
</record>
|
||||||
|
|
||||||
<record id="property_rule_attendace_manager" model="ir.rule">
|
<record id="property_rule_attendace_manager" model="ir.rule">
|
||||||
<field name="name">Manager Attendance</field>
|
<field name="name">Manager Attendance</field>
|
||||||
<field model="ir.model" name="model_id" ref="model_hr_attendance"/>
|
<field model="ir.model" name="model_id" ref="model_hr_attendance"/>
|
||||||
|
|
|
@ -57,9 +57,12 @@ openerp.hr_attendance = function (instance) {
|
||||||
var employee = new instance.web.DataSetSearch(self, 'hr.employee', self.session.user_context, [
|
var employee = new instance.web.DataSetSearch(self, 'hr.employee', self.session.user_context, [
|
||||||
['user_id', '=', self.session.uid]
|
['user_id', '=', self.session.uid]
|
||||||
]);
|
]);
|
||||||
return employee.read_slice(['id', 'name', 'state', 'last_sign']).pipe(function (res) {
|
return employee.read_slice(['id', 'name', 'state', 'last_sign', 'attendance_access']).pipe(function (res) {
|
||||||
if (_.isEmpty(res))
|
if (_.isEmpty(res) )
|
||||||
return;
|
return;
|
||||||
|
if (res[0].attendance_access == false){
|
||||||
|
return;
|
||||||
|
}
|
||||||
self.$el.show();
|
self.$el.show();
|
||||||
self.employee = res[0];
|
self.employee = res[0];
|
||||||
self.last_sign = instance.web.str_to_datetime(self.employee.last_sign);
|
self.last_sign = instance.web.str_to_datetime(self.employee.last_sign);
|
||||||
|
|
|
@ -64,9 +64,9 @@
|
||||||
<field name="company_id" groups="base.group_multi_company"/>
|
<field name="company_id" groups="base.group_multi_company"/>
|
||||||
</group>
|
</group>
|
||||||
<group>
|
<group>
|
||||||
<field name="total_attendance" widget="float_time"/>
|
<field name="total_attendance" widget="float_time" groups="base.group_hr_attendance"/>
|
||||||
<field name="total_timesheet" widget="float_time"/>
|
<field name="total_timesheet" widget="float_time"/>
|
||||||
<field name="total_difference" widget="float_time"/>
|
<field name="total_difference" widget="float_time" groups="base.group_hr_attendance"/>
|
||||||
<field name="user_id" invisible="1"/>
|
<field name="user_id" invisible="1"/>
|
||||||
</group>
|
</group>
|
||||||
</group>
|
</group>
|
||||||
|
@ -84,7 +84,7 @@
|
||||||
</div>
|
</div>
|
||||||
</group>
|
</group>
|
||||||
<group colspan="4" col="3">
|
<group colspan="4" col="3">
|
||||||
<field context="{'name':date_current,'user_id':user_id}" name="attendances_ids" nolabel="1">
|
<field context="{'name':date_current,'user_id':user_id}" name="attendances_ids" nolabel="1" groups="base.group_hr_attendance">
|
||||||
<tree string="Attendances" editable="bottom">
|
<tree string="Attendances" editable="bottom">
|
||||||
<field name="name"/>
|
<field name="name"/>
|
||||||
<field name="action"/>
|
<field name="action"/>
|
||||||
|
@ -92,14 +92,14 @@
|
||||||
</tree>
|
</tree>
|
||||||
</field>
|
</field>
|
||||||
<group>
|
<group>
|
||||||
<div align="right" groups="base.group_hr_manager">
|
<div align="right" groups="base.group_hr_manager,base.group_hr_attendance">
|
||||||
<button name="attendance_action_change" attrs="{'invisible': [('state_attendance', '=', 'present')]}" type="object" string="Sign In"/>
|
<button name="attendance_action_change" attrs="{'invisible': [('state_attendance', '=', 'present')]}" type="object" string="Sign In" groups="base.group_hr_attendance"/>
|
||||||
<button name="attendance_action_change" attrs="{'invisible': ['|', ('state_attendance','=',False), ('state_attendance', '=', 'absent')]}" type="object" string="Sign Out"/>
|
<button name="attendance_action_change" attrs="{'invisible': ['|', ('state_attendance','=',False), ('state_attendance', '=', 'absent')]}" type="object" string="Sign Out" groups="base.group_hr_attendance"/>
|
||||||
</div>
|
</div>
|
||||||
</group>
|
</group>
|
||||||
</group>
|
</group>
|
||||||
<group col="4">
|
<group col="4">
|
||||||
<field name="state_attendance"/>
|
<field name="state_attendance" groups="base.group_hr_attendance"/>
|
||||||
</group>
|
</group>
|
||||||
<field colspan="4" context="{'date':date_current,'user_id':user_id}" domain="[('name','=',date_current)]" name="timesheet_ids" nolabel="1">
|
<field colspan="4" context="{'date':date_current,'user_id':user_id}" domain="[('name','=',date_current)]" name="timesheet_ids" nolabel="1">
|
||||||
<tree editable="top" string="Timesheet Lines">
|
<tree editable="top" string="Timesheet Lines">
|
||||||
|
@ -134,9 +134,9 @@
|
||||||
<field colspan="4" name="period_ids" nolabel="1">
|
<field colspan="4" name="period_ids" nolabel="1">
|
||||||
<tree colors="red:total_difference<0.1;blue:total_difference>=0.1" string="Period">
|
<tree colors="red:total_difference<0.1;blue:total_difference>=0.1" string="Period">
|
||||||
<field name="name"/>
|
<field name="name"/>
|
||||||
<field name="total_attendance" widget="float_time"/>
|
<field name="total_attendance" widget="float_time" groups="base.group_hr_attendance"/>
|
||||||
<field name="total_timesheet" widget="float_time"/>
|
<field name="total_timesheet" widget="float_time"/>
|
||||||
<field name="total_difference" widget="float_time"/>
|
<field name="total_difference" widget="float_time" groups="base.group_hr_attendance"/>
|
||||||
</tree>
|
</tree>
|
||||||
</field>
|
</field>
|
||||||
</page>
|
</page>
|
||||||
|
@ -318,9 +318,9 @@
|
||||||
<field name="date_from"/>
|
<field name="date_from"/>
|
||||||
<field name="date_to"/>
|
<field name="date_to"/>
|
||||||
<field name="department_id"/>
|
<field name="department_id"/>
|
||||||
<field name="total_attendance" widget="float_time"/>
|
<field name="total_attendance" widget="float_time" groups="base.group_hr_attendance"/>
|
||||||
<field name="total_timesheet" widget="float_time"/>
|
<field name="total_timesheet" widget="float_time"/>
|
||||||
<field name="total_difference" widget="float_time"/>
|
<field name="total_difference" widget="float_time" groups="base.group_hr_attendance"/>
|
||||||
<field name="state"/>
|
<field name="state"/>
|
||||||
</tree>
|
</tree>
|
||||||
</field>
|
</field>
|
||||||
|
@ -332,9 +332,9 @@
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<tree colors="blue:total_difference<0.1;red:total_difference>=0.1" string="Period">
|
<tree colors="blue:total_difference<0.1;red:total_difference>=0.1" string="Period">
|
||||||
<field name="name"/>
|
<field name="name"/>
|
||||||
<field name="total_attendance" widget="float_time" sum="Total Attendances"/>
|
<field name="total_attendance" widget="float_time" sum="Total Attendances" groups="base.group_hr_attendance"/>
|
||||||
<field name="total_timesheet" widget="float_time" sum="Total Timesheet"/>
|
<field name="total_timesheet" widget="float_time" sum="Total Timesheet"/>
|
||||||
<field name="total_difference" widget="float_time" sum="Total Difference"/>
|
<field name="total_difference" widget="float_time" sum="Total Difference" groups="base.group_hr_attendance"/>
|
||||||
</tree>
|
</tree>
|
||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
|
|
|
@ -97,7 +97,7 @@
|
||||||
<menuitem action="hr_timesheet.action_hr_timesheet_sign_in"
|
<menuitem action="hr_timesheet.action_hr_timesheet_sign_in"
|
||||||
id="menu_hr_timesheet_sign_in"
|
id="menu_hr_timesheet_sign_in"
|
||||||
parent="hr_attendance.menu_hr_attendance"
|
parent="hr_attendance.menu_hr_attendance"
|
||||||
sequence="5" />
|
sequence="5" groups="base.group_hr_attendance" />
|
||||||
|
|
||||||
<menuitem id="menu_project_billing" name="Invoicing"
|
<menuitem id="menu_project_billing" name="Invoicing"
|
||||||
parent="base.menu_main_pm" sequence="5"/>
|
parent="base.menu_main_pm" sequence="5"/>
|
||||||
|
|
Loading…
Reference in New Issue