[IMP] HR Modules improvements (ref: PSI)

bzr revid: mra@mra-laptop-20100713133802-jgzks42h9x83ivmz
This commit is contained in:
Mustufa Rangwala 2010-07-13 19:08:02 +05:30
parent 6e28cc6257
commit e02ec78cfe
11 changed files with 62 additions and 19 deletions

View File

@ -7,7 +7,7 @@
name="Human Resources"
parent="base.dashboard"/>
<!-- This board view will be complete by other hr_* modules-->
<record id="board_hr_form" model="ir.ui.view">
<field name="name">board.hr.form</field>
<field name="model">board.board</field>

View File

@ -2,6 +2,43 @@
<openerp>
<data>
<!-- Employee Category -->
<record id="category1" model="hr.employee.category">
<field name="name">CEO</field>
</record>
<record id="category2" model="hr.employee.category">
<field name="name">CTO</field>
<field name="parent_id" ref="category1"/>
</record>
<record id="category3" model="hr.employee.category">
<field name="name">Managers(Tech. Heads)</field>
<field name="parent_id" ref="category2"/>
</record>
<record id="category4" model="hr.employee.category">
<field name="name">Project Managers</field>
<field name="parent_id" ref="category3"/>
</record>
<record id="category5" model="hr.employee.category">
<field name="name">Sr. Executives(Team Leads)</field>
<field name="parent_id" ref="category4"/>
</record>
<record id="category6" model="hr.employee.category">
<field name="name">Jr. Executives(Developers)</field>
<field name="parent_id" ref="category5"/>
</record>
<record id="category7" model="hr.employee.category">
<field name="name">Trainee(Intership)</field>
<field name="parent_id" ref="category6"/>
</record>
<!-- Example employee -->
<record id="employee1" model="hr.employee">
@ -9,6 +46,7 @@
<field name="calendar_id" ref="resource.timesheet_group1"/>
<!--<field name="regime">45</field>-->
<field name="user_id" ref="base.user_root"/>
<field name="category_id" ref="hr.category1"/>
<!--<field name="holiday_max">25</field>-->
</record>

View File

@ -62,7 +62,7 @@
<separator string="Position" colspan="2"/>
<field name="job_id" widget="selection"/>
<field name="department_id" widget="selection"/>
<field name="category_id" />
<field name="category_id" widget="selection"/>
<!--<separator string="Managers" colspan="2"/>
<field name="parent_id" />
<field name="coach_id" />-->
@ -88,6 +88,7 @@
<field name="work_email"/>
<field name="department_id"/>
<field name="job_id"/>
<field name="category_id"/>
<field name="parent_id"/>
<field name="coach_id" invisible="1" />
</tree>
@ -102,7 +103,9 @@
<search string="Employees">
<filter icon="terp-personal-" domain="[('active','=',False)]" string="Unactive" groups="base.group_extended"/>
<field name="name"/>
<field name="department_id" widget="selection"/>
<field name="department_id" widget="selection">
<filter icon="terp-personal+" domain="[('department_id','=',context.get('department_id',False))]" help="My Departments Employee"/>
</field>
<field name="job_id" widget="selection"/>
<field name="parent_id"/>
<newline />

View File

@ -60,7 +60,7 @@ class hr_attendance(osv.osv):
'day': fields.function(_day_compute, method=True, type='char', string='Day', store=True, select=1, size=32),
}
_defaults = {
'name': time.strftime('%Y-%m-%d %H:%M:%S'),
'name': lambda *a: time.strftime('%Y-%m-%d %H:%M:%S'), #Don't remove the lambda, if you remove it then the current time will not change
'employee_id': _employee_get,
}
@ -119,6 +119,7 @@ class hr_employee(osv.osv):
def attendance_action_change(self, cr, uid, ids, type='action', context=None, dt=False, *args):
id = False
warning_sign = 'sign'
res = {}
#Special case when button calls this method :type=context
if isinstance(type, dict):
@ -127,7 +128,6 @@ class hr_employee(osv.osv):
warning_sign = "Sign In"
elif type == 'sign_out':
warning_sign = "Sign Out"
for emp in self.read(cr, uid, ids, ['id'], context=context):
if not self._action_check(cr, uid, emp['id'], dt, context):
raise osv.except_osv(_('Warning'), _('You tried to %s with a date anterior to another event !\nTry to contact the administrator to correct attendances.')%(warning_sign,))

View File

@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
##############################################################################
#
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
@ -15,12 +15,12 @@
# 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/>.
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
import attendance_errors
import bymonth
import attendance_by_month
import timesheet
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -40,12 +40,13 @@ def hour2str(h):
class report_custom(report_rml):
def create_xml(self, cr, uid, ids, datas, context=None):
obj_emp = pooler.get_pool(cr.dbname).get('hr.employee')
if context is None:
context = {}
month = DateTime.DateTime(datas['form']['year'], datas['form']['month'], 1)
user_xml = ['<month>%s</month>' % month2name[month.month], '<year>%s</year>' % month.year]
for employee_id in ids:
emp = pooler.get_pool(cr.dbname).get('hr.employee').read(cr, uid, [employee_id], ['name'])[0]
emp = obj_emp.read(cr, uid, [employee_id], ['name'])[0]
stop, days_xml = False, []
user_repr = '''
<user>

View File

@ -37,6 +37,7 @@ def to_hour(h):
class report_custom(report_rml):
def create_xml(self, cr, uid, ids, datas, context=None):
obj_emp = pooler.get_pool(cr.dbname).get('hr.employee')
start_date = DateTime.strptime(datas['form']['init_date'], '%Y-%m-%d')
end_date = DateTime.strptime(datas['form']['end_date'], '%Y-%m-%d')
first_monday = start_date - DateTime.RelativeDateTime(days=start_date.day_of_week)
@ -47,7 +48,7 @@ class report_custom(report_rml):
user_xml = []
for employee_id in ids:
emp = pooler.get_pool(cr.dbname).get('hr.employee').read(cr, uid, [employee_id], ['id', 'name'])[0]
emp = obj_emp.read(cr, uid, [employee_id], ['id', 'name'])[0]
monday, n_monday = first_monday, first_monday + one_week
stop, week_xml = False, []
user_repr = '''

View File

@ -23,7 +23,7 @@
</record>
<record id="action_hr_attendance_month" model="ir.actions.act_window">
<field name="name">Print Timesheet by month</field>
<field name="name">Print Attendance by month</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">hr.attendance.month</field>
<field name="view_type">form</field>
@ -34,7 +34,7 @@
<record model="ir.values" id="hr_attendance_month_values">
<field name="model_id" ref="hr.model_hr_employee" />
<field name="object" eval="1" />
<field name="name">Print Timesheet by month</field>
<field name="name">Print Attendance by month</field>
<field name="key2">client_print_multi</field>
<field name="value" eval="'ir.actions.act_window,' + str(ref('action_hr_attendance_month'))" />
<field name="key">action</field>

View File

@ -2,7 +2,7 @@
<openerp>
<data>
<record id="view_hr_attendance_week" model="ir.ui.view">
<!--<record id="view_hr_attendance_week" model="ir.ui.view">
<field name="name">Attendance Report Week</field>
<field name="model">hr.attendance.week</field>
<field name="type">form</field>
@ -40,7 +40,7 @@
<field name="value" eval="'ir.actions.act_window,' + str(ref('action_hr_attendance_week'))" />
<field name="key">action</field>
<field name="model">hr.employee</field>
</record>
</record> -->
</data>
</openerp>

View File

@ -69,10 +69,10 @@
<field name="target">new</field>
</record>
<menuitem action="action_hr_timesheet_my"
<!--menuitem action="action_hr_timesheet_my"
id="menu_hr_timesheet_my"
parent="menu_hr_reporting_timesheet"
groups="hr.group_hr_user" sequence="4" icon="STOCK_PRINT"/>
groups="hr.group_hr_user" sequence="4" icon="STOCK_PRINT"/-->
</data>
</openerp>

View File

@ -718,9 +718,9 @@ class res_company(osv.osv):
_inherit = 'res.company'
_columns = {
'timesheet_range': fields.selection(
[('day','Day'),('week','Week'),('month','Month'),('year','Year')], 'Timeshet range'),
'timesheet_max_difference': fields.float('Timesheet allowed difference',
help="Allowed difference between the sign in/out and the timesheet " \
[('day','Day'),('week','Week'),('month','Month'),('year','Year')], 'Timesheet range'),
'timesheet_max_difference': fields.float('Timesheet allowed difference(Hours)',
help="Allowed difference in hours between the sign in/out and the timesheet " \
"computation for one sheet. Set this to 0 if you do not want any control."),
}
_defaults = {