[IMP] hr_holidays: Improved search, tree view of holiday and onchange method
bzr revid: pso@tinyerp.com-20110426064116-47pn4y5yuifsbjmg
This commit is contained in:
@@ -160,15 +160,13 @@ class hr_holidays(osv.osv):
|
||||
return obj_res_leave.unlink(cr, uid, leave_ids)
|
||||
|
||||
def onchange_type(self, cr, uid, ids, holiday_type):
|
||||
result = {}
|
||||
result = {'value': {'employee_id': False}}
|
||||
if holiday_type == 'employee':
|
||||
ids_employee = self.pool.get('hr.employee').search(cr, uid, [('user_id','=', uid)])
|
||||
if ids_employee:
|
||||
result['value'] = {
|
||||
'employee_id': ids_employee[0]
|
||||
}
|
||||
else:
|
||||
result['value'] = {'employee_id': False}
|
||||
return result
|
||||
|
||||
# TODO: can be improved using resource calendar method
|
||||
|
||||
@@ -36,8 +36,8 @@
|
||||
</group>
|
||||
<newline />
|
||||
<group expand="0" string="Group By...">
|
||||
<filter name="group_category" string="Category" icon="terp-stock_symbol-selection" domain="[]" context="{'group_by':'category_id'}"/>
|
||||
<filter name="group_employee" string="Employee" icon="terp-personal" domain="[]" context="{'group_by':'employee_id'}"/>
|
||||
<filter name="group_category" string="Category" icon="terp-stock_symbol-selection" domain="[]" context="{'group_by':'category_id'}"/>
|
||||
<filter string="Manager" icon="terp-personal" domain="[]" context="{'group_by':'manager_id'}"/>
|
||||
<filter string="Department" icon="terp-personal+" domain="[]" context="{'group_by':'department_id','set_visible':True}"/>
|
||||
<separator orientation="vertical"/>
|
||||
@@ -234,6 +234,7 @@
|
||||
<field name="type">tree</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree colors="red:state in ('refuse');blue:state in (' draft');black:state in ('confirm','validate','validate1')">
|
||||
<field name="holiday_type"/>
|
||||
<field name="employee_id"/>
|
||||
<field name="category_id"/>
|
||||
<field name="department_id" invisible="not context.get('set_visible',False)"/>
|
||||
|
||||
Reference in New Issue
Block a user