[MERGE] cherry picking of revision 4425-4432 of lp:~openerp-dev/openobject-addons/trunk-dev2-hr-improvements

bzr revid: qdp-launchpad@openerp.com-20110314104431-xxyxcv7mercqqhzt
This commit is contained in:
Quentin (OpenERP) 2011-03-14 11:44:31 +01:00
parent 51fda3b52f
commit 670141cbf5
5 changed files with 49 additions and 17 deletions

View File

@ -20,7 +20,7 @@
##############################################################################
from osv import fields, osv
import logging
import addons
class hr_employee_category(osv.osv):
@ -154,7 +154,7 @@ class hr_employee(osv.osv):
'work_email': fields.char('Work E-mail', size=240),
'work_location': fields.char('Office Location', size=32),
'notes': fields.text('Notes'),
'parent_id': fields.related('department_id', 'manager_id', relation='hr.employee', string='Manager', type='many2one', store=True, select=True, help="It is linked with manager of Department"),
'parent_id': fields.many2one('hr.employee', 'Manager'),
'category_ids': fields.many2many('hr.employee.category', 'employee_category_rel','category_id','emp_id','Category'),
'child_ids': fields.one2many('hr.employee', 'parent_id', 'Subordinates'),
'resource_id': fields.many2one('resource.resource', 'Resource', ondelete='cascade', required=True),
@ -204,15 +204,8 @@ class hr_employee(osv.osv):
level -= 1
return True
# def _check_department_id(self, cr, uid, ids, context=None):
# for emp in self.browse(cr, uid, ids, context=context):
# if emp.department_id.manager_id and emp.id == emp.department_id.manager_id.id:
# return False
# return True
_constraints = [
(_check_recursion, 'Error ! You cannot create recursive Hierarchy of Employees.', ['parent_id']),
# (_check_department_id, 'Error ! You cannot select a department for which the employee is the manager.', ['department_id']),
]
hr_employee()
@ -227,4 +220,26 @@ class hr_department(osv.osv):
hr_department()
class res_users(osv.osv):
_name = 'res.users'
_inherit = 'res.users'
def create(self, cr, uid, data, context=None):
user_id = super(res_users, self).create(cr, uid, data, context=context)
data_obj = self.pool.get('ir.model.data')
try:
data_id = data_obj._get_id(cr, uid, 'hr', 'ir_ui_view_sc_employee')
view_id = data_obj.browse(cr, uid, data_id, context=context).res_id
self.pool.get('ir.ui.view_sc').copy(cr, uid, view_id, default = {
'user_id': user_id}, context=context)
except:
# Tolerate a missing shortcut. See product/product.py for similar code.
logging.getLogger('orm').debug('Skipped meetings shortcut for user "%s"', data.get('name','<new'))
return user_id
res_users()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -157,6 +157,13 @@
<menuitem action="open_view_employee_list_my" id="menu_open_view_employee_list_my" sequence="3" parent="menu_hr_main"/>
<record id="ir_ui_view_sc_employee" model="ir.ui.view_sc">
<field name="name">Employees</field>
<field name="resource">ir.ui.menu</field>
<field name="user_id" ref="base.user_root"/>
<field name="res_id" ref="hr.menu_open_view_employee_list_my"/>
</record>
<!--
=======================
Employee marital status
@ -220,7 +227,7 @@
</record>
<record id="action2" model="ir.actions.act_window">
<field name="name">Employee Hierarchy</field>
<field name="name">Subordonate Hierarchy</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">hr.employee</field>
<field name="domain">[('id','in',active_ids)]</field>
@ -232,7 +239,7 @@
<field eval="'action'" name="key"/>
<field eval="'client_action_multi'" name="key2"/>
<field eval="['hr.employee']" name="models"/>
<field name="name">Employees Hierarchy</field>
<field name="name">Subordonate Hierarchy</field>
<field eval="'ir.actions.act_window,'+str(action2)" name="value"/>
<field eval="True" name="isobject"/>
<field eval="True" name="replace"/>

View File

@ -22,5 +22,14 @@
<field name="color_name">red</field>
</record>
<!-- Compensatory Days -->
<record model="hr.holidays.status" id="holiday_status_comp">
<field name="name">Compensatory Days</field>
<field name="limit">False</field>
<field name="color_name">brown</field>
</record>
</data>
</openerp>

View File

@ -24,7 +24,7 @@
help="My Leaves" />
</field>
<field name="department_id" widget="selection">
<filter icon="terp-personal+" help="My Department Holidays"
<filter icon="terp-personal+" help="My Department Leaves"
domain="[('department_id.manager_id','=',uid)]" />
</field>
<field name="holiday_status_id" widget="selection"/>
@ -70,7 +70,7 @@
<form string="Leave Request">
<group col="8" colspan="4">
<field name="name" attrs="{'readonly':[('state','!=','draft'),('state','!=','confirm')]}" />
<field name="holiday_type" on_change="onchange_type(holiday_type)" attrs="{'readonly':[('state','!=','draft')]}" width="130" groups="base.group_hr_manager, base.group_extended" string="Leave Type"/>
<field name="holiday_type" on_change="onchange_type(holiday_type)" attrs="{'readonly':[('state','!=','draft')]}" width="130" groups="base.group_hr_manager,base.group_extended"/>
<group attrs="{'invisible':[('holiday_type','=','employee')]}">
<field name="category_id" attrs="{'required':[('holiday_type','=','category')], 'readonly':[('state','!=','draft')]}"/>
</group>
@ -114,7 +114,7 @@
<form string="Allocation Request">
<group col="8" colspan="4">
<field name="name" />
<field name="holiday_type" on_change="onchange_type(holiday_type)" attrs="{'readonly':[('state','!=','draft')]}" string="Allocation Type" groups="base.group_hr_manager, base.group_extended"/>
<field name="holiday_type" on_change="onchange_type(holiday_type)" attrs="{'readonly':[('state','!=','draft')]}" groups="base.group_hr_manager, base.group_extended"/>
<group attrs="{'invisible':[('holiday_type','=','category')]}">
<field name="employee_id" attrs="{'required':[('holiday_type','=','employee')]}"/>
</group>
@ -250,7 +250,7 @@
<!-- My leave dashboard -->
<menuitem
name="Holidays"
name="Leaves"
parent="hr.menu_hr_root"
id="menu_open_ask_holidays"
sequence="5"/>
@ -412,7 +412,7 @@
<field name="search_view_id" ref="view_hr_holidays_status_search"/>
</record>
<menuitem sequence="3" id="hr.menu_open_view_attendance_reason_config" parent="hr.menu_hr_configuration" name="Holidays"/>
<menuitem sequence="3" id="hr.menu_open_view_attendance_reason_config" parent="hr.menu_hr_configuration" name="Leaves"/>
<menuitem name="Leave Type"
action="open_view_holiday_status"
@ -433,7 +433,7 @@
</record>
<!-- Shortcuts -->
<act_window name="Holidays"
<act_window name="Leaves"
domain="[('type','=','remove')]"
context="{'search_default_employee_id': [active_id]}"
res_model="hr.holidays"

View File

@ -34,6 +34,7 @@
partner_name: Marion Jones
partner_phone: '1111112223'
response: 0.0
job_id: hr.job_jr_developers
salary_expected: 0.0
salary_proposed: 0.0
stage_id: hr_recrutiment_stage_first0