[IMP] HR Leaves useability

bzr revid: fp@tinyerp.com-20121126074101-emvux1ullg1txoly
This commit is contained in:
Fabien Pinckaers 2012-11-26 08:41:01 +01:00
commit 1651164755
4 changed files with 22 additions and 31 deletions

View File

@ -9,7 +9,6 @@
sequence="90"/>
<menuitem id="menu_hr_main" parent="menu_hr_root" name="Human Resources" sequence="0"/>
<menuitem id="menu_hr_configuration" name="Configuration" parent="hr.menu_hr_root" groups="base.group_hr_manager" sequence="50"/>
<menuitem id="menu_hr_management" name="Human Resources" parent="hr.menu_hr_configuration" groups="base.group_no_one" sequence="25"/>
<menuitem id="menu_hr_reporting_timesheet" name="Reports"
parent="menu_hr_reporting" sequence="6"/>
@ -288,7 +287,7 @@
</record>
<record id="open_view_categ_form" model="ir.actions.act_window">
<field name="name">Categories of Employees</field>
<field name="name">Employee Tags</field>
<field name="res_model">hr.employee.category</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
@ -297,14 +296,6 @@
<menuitem action="open_view_categ_form" id="menu_view_employee_category_form"
parent="hr.menu_hr_configuration" sequence="1" groups="base.group_no_one"/>
<record id="open_view_categ_tree" model="ir.actions.act_window">
<field name="name">Categories Structure</field>
<field name="res_model">hr.employee.category</field>
<field name="view_type">tree</field>
<field name="view_id" ref="view_employee_category_tree"/>
<field name="domain">[('parent_id','=',False)]</field>
</record>
<record id="hr_employee_normal_action_tree" model="ir.actions.act_window">
<field name="name">Employees</field>
<field name="type">ir.actions.act_window</field>
@ -321,9 +312,6 @@
<field eval="'ir.actions.act_window,%d'%hr_employee_normal_action_tree" name="value"/>
</record>
<menuitem action="open_view_categ_tree"
id="menu_view_employee_category_tree" parent="menu_hr_management" groups="base.group_no_one" sequence="2"/>
<record id="view_hr_job_form" model="ir.ui.view">
<field name="name">hr.job.form</field>
<field name="model">hr.job</field>

View File

@ -211,7 +211,7 @@
<field name="search_view_id" ref="product.product_search_form_view"/>
</record>
<menuitem id="menu_hr_product" name="Type of Expenses" parent="hr.menu_hr_configuration" action="hr_expense_product"/>
<menuitem id="menu_hr_product" name="Types of Expenses" parent="hr.menu_hr_configuration" action="hr_expense_product"/>
<menuitem id="next_id_49" name="Expenses" sequence="15" parent="hr.menu_hr_root"/>
<menuitem action="expense_all" id="menu_expense_all" name="Expenses" parent="next_id_49"/>

View File

@ -79,7 +79,7 @@ class hr_holidays_status(osv.osv):
'categ_id': fields.many2one('crm.meeting.type', 'Meeting Type',
help='Once a leave is validated, OpenERP will create a corresponding meeting of this type in the calendar.'),
'color_name': fields.selection([('red', 'Red'),('blue','Blue'), ('lightgreen', 'Light Green'), ('lightblue','Light Blue'), ('lightyellow', 'Light Yellow'), ('magenta', 'Magenta'),('lightcyan', 'Light Cyan'),('black', 'Black'),('lightpink', 'Light Pink'),('brown', 'Brown'),('violet', 'Violet'),('lightcoral', 'Light Coral'),('lightsalmon', 'Light Salmon'),('lavender', 'Lavender'),('wheat', 'Wheat'),('ivory', 'Ivory')],'Color in Report', required=True, help='This color will be used in the leaves summary located in Reporting\Leaves by Department.'),
'limit': fields.boolean('Allow to Override Limit', help='If you select this checkbox, the system allows the employees to take more leaves than the available ones for this type.'),
'limit': fields.boolean('Allow to Override Limit', help='If you select this check box, the system allows the employees to take more leaves than the available ones for this type and take them into account for the "Remaining Legal Leaves" defined on the employee form.'),
'active': fields.boolean('Active', help="If the active field is set to false, it will allow you to hide the leave type without removing it."),
'max_leaves': fields.function(_user_left_days, string='Maximum Allowed', help='This value is given by the sum of all holidays requests with a positive value.', multi='user_left_days'),
'leaves_taken': fields.function(_user_left_days, string='Leaves Already Taken', help='This value is given by the sum of all holidays requests with a negative value.', multi='user_left_days'),
@ -146,15 +146,15 @@ class hr_holidays(osv.osv):
'employee_id': fields.many2one('hr.employee', "Employee", select=True, invisible=False, readonly=True, states={'draft':[('readonly',False)], 'confirm':[('readonly',False)]}, help='Leave Manager can let this field empty if this leave request/allocation is for every employee'),
'manager_id': fields.many2one('hr.employee', 'First Approval', invisible=False, readonly=True, help='This area is automatically filled by the user who validate the leave'),
'notes': fields.text('Reasons',readonly=True, states={'draft':[('readonly',False)], 'confirm':[('readonly',False)]}),
'number_of_days_temp': fields.float('Number of Days', readonly=True, states={'draft':[('readonly',False)], 'confirm':[('readonly',False)]}),
'number_of_days_temp': fields.float('Allocation', readonly=True, states={'draft':[('readonly',False)], 'confirm':[('readonly',False)]}),
'number_of_days': fields.function(_compute_number_of_days, string='Number of Days', store=True),
'meeting_id': fields.many2one('crm.meeting', 'Meeting'),
'type': fields.selection([('remove','Leave Request'),('add','Allocation Request')], 'Request Type', required=True, readonly=True, states={'draft':[('readonly',False)], 'confirm':[('readonly',False)]}, help="Choose 'Leave Request' if someone wants to take an off-day. \nChoose 'Allocation Request' if you want to increase the number of leaves available for someone", select=True),
'parent_id': fields.many2one('hr.holidays', 'Parent'),
'linked_request_ids': fields.one2many('hr.holidays', 'parent_id', 'Linked Requests',),
'department_id':fields.related('employee_id', 'department_id', string='Department', type='many2one', relation='hr.department', readonly=True, store=True),
'category_id': fields.many2one('hr.employee.category', "Category", help='Category of Employee', readonly=True, states={'draft':[('readonly',False)], 'confirm':[('readonly',False)]}),
'holiday_type': fields.selection([('employee','By Employee'),('category','By Employee Category')], 'Allocation Mode', readonly=True, states={'draft':[('readonly',False)], 'confirm':[('readonly',False)]}, help='By Employee: Allocation/Request for individual Employee, By Employee Category: Allocation/Request for group of employees in category', required=True),
'category_id': fields.many2one('hr.employee.category', "Employee Tag", help='Category of Employee', readonly=True, states={'draft':[('readonly',False)], 'confirm':[('readonly',False)]}),
'holiday_type': fields.selection([('employee','By Employee'),('category','By Employee Tag')], 'Allocation Mode', readonly=True, states={'draft':[('readonly',False)], 'confirm':[('readonly',False)]}, help='By Employee: Allocation/Request for individual Employee, By Employee Tag: Allocation/Request for group of employees in category', required=True),
'manager_id2': fields.many2one('hr.employee', 'Second Approval', readonly=True, help='This area is automaticly filled by the user who validate the leave with second level (If Leave type need second validation)'),
'double_validation': fields.related('holiday_status_id', 'double_validation', type='boolean', relation='hr.holidays.status', string='Apply Double Validation'),
}
@ -541,7 +541,7 @@ class hr_employee(osv.osv):
return result
_columns = {
'remaining_leaves': fields.function(_get_remaining_days, string='Remaining Legal Leaves', fnct_inv=_set_remaining_days, type="float", help='Total number of legal leaves allocated to this employee, change this value to create allocation/leave requests.'),
'remaining_leaves': fields.function(_get_remaining_days, string='Remaining Legal Leaves', fnct_inv=_set_remaining_days, type="float", help='Total number of legal leaves allocated to this employee, change this value to create allocation/leave request. Total based on all the leave types without overriding limit.'),
'current_leave_state': fields.function(_get_leave_status, multi="leave_status", string="Current Leave Status", type="selection",
selection=[('draft', 'New'), ('confirm', 'Waiting Approval'), ('refuse', 'Refused'),
('validate1', 'Waiting Second Approval'), ('validate', 'Approved'), ('cancel', 'Cancelled')]),

View File

@ -146,7 +146,10 @@
<group>
<field name="name" required="1" attrs="{'readonly':[('state','!=','draft'),('state','!=','confirm')]}"/>
<field name="holiday_status_id" context="{'employee_id':employee_id}"/>
<field name="number_of_days_temp"/>
<label for="number_of_days_temp"/>
<div>
<field name="number_of_days_temp" class="oe_inline"/> days
</div>
</group>
<group>
<field name="holiday_type" on_change="onchange_type(holiday_type)"/>
@ -176,7 +179,7 @@
<field name="department_id" invisible="1"/>
<field name="holiday_status_id"/>
<field name="name"/>
<field name="number_of_days" string="Number of Days" sum="Remaining Days"/>
<field name="number_of_days" string="Allocated Days" sum="Remaining Days"/>
<field name="manager_id" invisible="1"/>
<field name="user_id" invisible="1"/>
<!--field name="type"/-->
@ -257,12 +260,12 @@
<menuitem name="Leaves" parent="hr.menu_hr_root" id="menu_open_ask_holidays" sequence="20"/>
<record model="ir.actions.act_window" id="open_ask_holidays">
<field name="name">My Leave Requests</field>
<field name="name">Leave Requests</field>
<field name="res_model">hr.holidays</field>
<field name="view_type">form</field>
<field name="view_id" ref="edit_holiday_new"/>
<field name="context">{}</field>
<field name="domain">[('type','=','remove'),('employee_id.user_id','=', uid)]</field>
<field name="context">{'default_type': 'remove', 'search_default_my_leaves':1}</field>
<field name="domain">[('type','=','remove')]</field>
<field name="search_view_id" ref="view_hr_holidays_filter"/>
<field name="help" type="html">
<p class="oe_view_nocontent_create">
@ -297,7 +300,7 @@
<field name="act_window_id" ref="open_ask_holidays"/>
</record>
<menuitem name="My Leave Requests" parent="menu_open_ask_holidays" id="menu_open_ask_holidays_new" action="open_ask_holidays"/>
<menuitem parent="menu_open_ask_holidays" id="menu_open_ask_holidays_new" action="open_ask_holidays"/>
<record model="ir.actions.act_window" id="request_approve_holidays">
<field name="name">Requests Approve</field>
@ -326,11 +329,11 @@
<menuitem name="Leave Requests to Approve" parent="menu_open_ask_holidays" id="menu_request_approve_holidays" action="request_approve_holidays" groups="base.group_hr_user"/>
<record model="ir.actions.act_window" id="open_allocation_holidays">
<field name="name">My Allocation Requests</field>
<field name="name">Allocation Requests</field>
<field name="res_model">hr.holidays</field>
<field name="view_type">form</field>
<field name="context">{'default_type':'add'}</field>
<field name="domain">[('type','=','add'),('employee_id.user_id','=', uid)]</field>
<field name="context">{'default_type':'add', 'search_default_my_leaves':1}</field>
<field name="domain">[('type','=','add')]</field>
<field name="view_id" ref="allocation_leave_new"/>
<field name="search_view_id" ref="view_hr_holidays_filter"/>
</record>
@ -349,7 +352,7 @@
<field name="act_window_id" ref="open_allocation_holidays"/>
</record>
<menuitem name="My Allocation Requests" parent="menu_open_ask_holidays" id="menu_open_allocation_holidays" action="open_allocation_holidays"/>
<menuitem parent="menu_open_ask_holidays" id="menu_open_allocation_holidays" action="open_allocation_holidays"/>
<record model="ir.actions.act_window" id="request_approve_allocation">
<field name="name">Allocation Requests to Approve</field>
@ -476,7 +479,7 @@
</record>
<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" id="menu_open_view_holiday_status" parent="hr.menu_hr_configuration" sequence="10"/>
<menuitem name="Leaves Types" action="open_view_holiday_status" id="menu_open_view_holiday_status" parent="hr.menu_hr_configuration" sequence="10"/>
<!-- Holiday on resource leave -->
<record id="resource_calendar_leave_form_inherit" model="ir.ui.view">
@ -541,7 +544,7 @@
<group string="Leaves">
<label for="remaining_leaves"/>
<div>
<field name="remaining_leaves" class="oe_inline"/>
<field name="remaining_leaves" class="oe_inline"/> days
</div>
</group>
</xpath>