[MOD]hr_holidays : usability improvement

bzr revid: dbr@tinyerp.com-20100906104748-g8i4tbp6azddo4rt
This commit is contained in:
DBR (OpenERP)
2010-09-06 16:17:48 +05:30
parent fd3c05ef1d
commit ec32dee73b
2 changed files with 28 additions and 26 deletions
+7 -5
View File
@@ -132,10 +132,12 @@ class hr_holidays(osv.osv):
'date_from': fields.datetime('Start Date', readonly=True, states={'draft':[('readonly',False)]}),
'user_id':fields.many2one('res.users', 'User', states={'draft':[('readonly',False)]}, select=True, readonly=True),
'date_to': fields.datetime('End Date', readonly=True, states={'draft':[('readonly',False)]}),
'holiday_status_id' : fields.many2one("hr.holidays.status", " Leave Type", required=True,readonly=True, states={'draft':[('readonly',False)]}),
'holiday_status_id' : fields.many2one("hr.holidays.status", " Leave Type", required=True,readonly=True, states={'draft':[('readonly',False)]}),
'employee_id' : fields.many2one('hr.employee', "Employee", select=True, invisible=False, readonly=True, states={'draft':[('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', 'Leave Manager', invisible=False, readonly=True, help='This area is automaticly filled by the user who validate the leave'),
'notes': fields.text('Notes',readonly=True, states={'draft':[('readonly',False)]}),
#'manager_id': fields.many2one('hr.employee', 'Leave Manager', invisible=False, readonly=True, help='This area is automaticly filled by the user who validate the leave'),
#'notes': fields.text('Notes',readonly=True, states={'draft':[('readonly',False)]}),
'manager_id': fields.many2one('hr.employee', 'First Approval', invisible=False, readonly=True, help='This area is automaticly filled by the user who validate the leave'),
'notes': fields.text('Reasons',readonly=True, states={'draft':[('readonly',False)]}),
'number_of_days': fields.float('Number of Days', readonly=True, states={'draft':[('readonly',False)]}),
'number_of_days_temp': fields.float('Number of Days', readonly=True, states={'draft':[('readonly',False)]}),
'case_id': fields.many2one('crm.meeting', 'Case'),
@@ -145,8 +147,8 @@ class hr_holidays(osv.osv):
'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'),
'holiday_type': fields.selection([('employee','By Employee'),('category','By Employee Category')], 'Holiday Type', help='By Employee: Allocation/Request for individual Employee, By Employee Category: Allocation/Request for group of employees in category'),
'manager_id2': fields.many2one('hr.employee', 'Second Validator', readonly=True, help='This area is automaticly filled by the user who validate the leave with second level (If Leave type need second validation)')
'holiday_type': fields.selection([('employee','By Employee'),('category','By Employee Category')], 'Allocation Type', help='By Employee: Allocation/Request for individual Employee, By Employee Category: Allocation/Request for group of employees in category'),
'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)')
}
_defaults = {
+21 -21
View File
@@ -10,7 +10,8 @@
<search string="Search Leave">
<group col='8' colspan='4'>
<filter icon="terp-camera_test" domain="[('state','=','validate')]" string="Validated"
default="context.get('report', False)"/>
default="context.get('report', False)"/>
<separator orientation="vertical"/>
<separator orientation="vertical"/>
<filter icon="terp-gtk-go-back-rtl" domain="[('state','=','draft')]" string="To Confirm"/>
<filter icon="terp-gtk-go-back-rtl" domain="[('state','=','confirm')]" string="To Approve"/>
@@ -26,14 +27,14 @@
</group>
<newline />
<group expand="0" string="Group By...">
<filter string="User" icon="terp-personal" domain="[]" context="{'group_by':'user_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'}"/>
<separator orientation="vertical"/>
<filter string="State" icon="terp-stock_effects-object-colorize" domain="[]" context="{'group_by':'state'}"/>
<separator orientation="vertical"/>
<filter string="Employee" icon="terp-personal" domain="[]" context="{'group_by':'employee_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'}"/>
<separator orientation="vertical"/>
<filter string="Type" icon="terp-stock_symbol-selection" domain="[]" context="{'group_by':'holiday_status_id'}"
default="context.get('report', False)"/>
<separator orientation="vertical"/>
<filter string="State" icon="terp-stock_effects-object-colorize" domain="[]" context="{'group_by':'state'}"/>
</group>
</search>
</field>
@@ -61,7 +62,7 @@
<form string="Leave Request">
<group col="8" colspan="4">
<field name="name" />
<field name="holiday_type" on_change="onchange_type(holiday_type)" attrs="{'readonly':[('state','!=','draft')]}" width="130"/>
<field name="holiday_type" on_change="onchange_type(holiday_type)" attrs="{'readonly':[('state','!=','draft')]}" width="130" groups="base.group_hr_manager"/>
<group attrs="{'invisible':[('holiday_type','=','employee')]}">
<field name="category_id" attrs="{'required':[('holiday_type','=','category')], 'readonly':[('state','!=','draft')]}"/>
</group>
@@ -79,7 +80,7 @@
<newline/>
<field name="manager_id"/>
<field name="manager_id2"/>
<separator string="Notes" colspan="4"/>
<separator string="Reasons" colspan="4"/>
<field name="notes" nolabel="1" colspan="4"/>
<newline/>
<field name="state" colspan="2"/>
@@ -104,32 +105,31 @@
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Allocation Request">
<group col="4" colspan="4">
<group col="8" colspan="4">
<field name="name" />
<field name="holiday_status_id" />
<field name="holiday_type" on_change="onchange_type(holiday_type)" attrs="{'readonly':[('state','!=','draft')]}" string="Allocation Type"/>
<group col="2" colspan="2">
<group attrs="{'invisible':[('holiday_type','=','category')]}">
<field name="employee_id" attrs="{'required':[('holiday_type','=','employee')]}"/>
</group>
<group attrs="{'invisible':[('holiday_type','=','employee')]}">
<field name="category_id" attrs="{'required':[('holiday_type','=','category')], 'readonly':[('state','!=','draft')]}"/>
</group>
</group>
</group>
<notebook colspan="4">
<page string="General">
<field name="holiday_status_id" on_change="onchange_sec_id(holiday_status_id)" context="{'employee_id':employee_id}" />
<field name="department_id"/>
<field name="number_of_days_temp"/>
<field name="department_id"/>
<newline/>
<field name="manager_id"/>
<field name="manager_id2"/>
<separator string="Notes" colspan="4"/>
<separator string="Reasons" colspan="4"/>
<field name="notes" nolabel="1" colspan="4" />
<newline/>
<field name="state" colspan="2"/>
<group colspan="2">
<button string="Confirm" name="confirm" states="draft" type="workflow" icon="gtk-yes"/>
<button string="To Approve" name="validate" states="confirm" type="workflow" icon="gtk-apply"/>
<button string="Approve" name="validate" states="confirm" type="workflow" icon="gtk-apply"/>
<button string="Approved" name="second_validate" states="validate1" type="workflow" icon="gtk-apply"/>
<button string="Refuse" name="refuse" states="confirm,validate1" type="workflow" icon="gtk-no"/>
<button string="Cancel" name="cancel" states="validate,refuse" type="workflow" icon="gtk-cancel"/>
@@ -149,12 +149,12 @@
<tree colors="red:state in ('refuse');blue:state in (' draft');black:state in ('confirm','validate','validate1');gray:state in ('cancel') " string="Leaves" >
<field name="employee_id"/>
<field name="department_id"/>
<field name="number_of_days" string="Number of Days" sum='Remaining Days'/>
<field name="name"/>
<field name="holiday_status_id"/>
<field name="name"/>
<field name="number_of_days" string="Number of Days" sum='Remaining Days'/>
<field name="manager_id" invisible="1"/>
<field name="user_id" invisible="1"/>
<field name="type"/>
<!--field name="type"/-->
<field name="state"/>
</tree>
</field>
@@ -201,14 +201,14 @@
<tree colors="red:state in ('refuse');blue:state in (' draft');black:state in ('confirm','validate','validate1');gray:state in ('cancel')" string="Leaves Summary">
<field name="employee_id"/>
<field name="department_id" invisible="1"/>
<field name="type"/>
<field name="name"/>
<field name="number_of_days" string="Number of Days" sum='Remaining Days'/>
<field name="date_from"/>
<field name="date_to"/>
<field name="name" invisible="1"/>
<field name="holiday_status_id"/>
<field name="manager_id" invisible="1"/>
<field name="user_id" invisible="1"/>
<field name="type" invisible="1"/>
<field name="state"/>
</tree>
</field>