[IMP]hr_holidays : view are improved

bzr revid: hsa@tinyerp.com-20120706140616-nylt94v652w9k2eg
This commit is contained in:
Hardik
2012-07-06 19:36:16 +05:30
parent 5babd88330
commit bb118fae42
2 changed files with 29 additions and 44 deletions
+1 -2
View File
@@ -111,7 +111,7 @@ class hr_holidays(osv.osv):
return result
_columns = {
'name': fields.char('Description', required=True, size=64),
'name': fields.text('Description'),
'state': fields.selection([('draft', 'To Submit'), ('cancel', 'Cancelled'),('confirm', 'To Approve'), ('refuse', 'Refused'), ('validate1', 'Second Approval'), ('validate', 'Approved')],
'State', readonly=True, help='The state is set to \'To Submit\', when a holiday request is created.\
\nThe state is \'To Approve\', when holiday request is confirmed by user.\
@@ -125,7 +125,6 @@ class hr_holidays(osv.osv):
#'manager_id': fields.many2one('hr.employee', 'Leave Manager', invisible=False, readonly=True, help='This area is automatically 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 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': fields.function(_compute_number_of_days, string='Number of Days', store=True),
'case_id': fields.many2one('crm.meeting', 'Meeting'),
+28 -42
View File
@@ -112,39 +112,32 @@
<sheet string="Leave Request">
<group>
<group>
<field name="name" attrs="{'readonly':[('state','!=','draft'),('state','!=','confirm')]}"/>
<field name="holiday_status_id" on_change="onchange_sec_id(holiday_status_id)" context="{'employee_id':employee_id}"/>
<label for="number_of_days_temp" string="Duration"/>
<group col="3">
<field name="date_from" on_change="onchange_date_from(date_to, date_from)" required="1" nolabel="1" class="oe_online"/>
<label string="-"/>
<field name="date_to" on_change="onchange_date_from(date_to, date_from)" required="1" nolabel="1" class="oe_online"/>
<div><field name="number_of_days_temp" nolabel="1" class="oe_inline"/> <label string="days" class="oe_inline"/></div>
</group>
</group>
<group>
<field name="holiday_type" on_change="onchange_type(holiday_type)" attrs="{'readonly':[('state','!=','draft')]}" width="130" string="Mode" groups="base.group_hr_user"/>
<field name="employee_id" attrs="{'required':[('holiday_type','=','employee')],'invisible':[('holiday_type','=','category')]}" groups="base.group_hr_user"/>
<field name="category_id" attrs="{'required':[('holiday_type','=','category')], 'invisible':[('holiday_type','=','employee')], 'readonly':[('state','!=','draft'), ('state','!=','confirm')]}"/>
<field name="department_id" attrs="{'readonly':[('holiday_type','=','category')]}" groups="base.group_hr_user"/>
</group>
</group>
<group>
<group>
<field name="holiday_status_id" on_change="onchange_sec_id(holiday_status_id)" context="{'employee_id':employee_id}"/>
<label for="number_of_days_temp" string="Duration"/>
<div>
<field name="date_from" on_change="onchange_date_from(date_to, date_from)" required="1" class="oe_inline"/> -
<field name="date_to" on_change="onchange_date_from(date_to, date_from)" required="1" class="oe_inline"/>
<div>
<field name="number_of_days_temp" class="oe_inline"/> days
</div>
</div>
<field name="double_validation" invisible="1"/>
</group>
<group>
<field name="manager_id2" attrs="{'invisible':[('double_validation', '!=', True)]}" groups="base.group_no_one"/>
</group>
</group>
<notebook colspan="4">
<page string="General">
<group>
<group>
<field name="manager_id" groups="base.group_no_one"/>
<field name="double_validation" invisible="1"/>
</group>
<group>
<field name="manager_id2" attrs="{'invisible':[('double_validation', '!=', True)]}" groups="base.group_no_one"/>
</group>
</group>
<newline/>
<field name="notes" nolabel="1" colspan="4" placeholder="Add a reason..."/>
</page>
</notebook>
<newline/>
<field name="name" attrs="{'readonly':[('state','!=','draft'),('state','!=','confirm')]}"/>
</sheet>
<footer>
<field name="message_ids" colspan="4" widget="mail_thread" nolabel="1"/>
@@ -171,27 +164,21 @@
<sheet>
<group>
<group>
<field name="name"/>
<field name="holiday_status_id" on_change="onchange_sec_id(holiday_status_id)" context="{'employee_id':employee_id}"/>
<field name="number_of_days_temp"/>
</group>
<group>
<field name="holiday_type" on_change="onchange_type(holiday_type)" attrs="{'readonly':[('state','!=','draft')]}" string="Allocation Mode" groups="base.group_hr_manager"/>
<field name="employee_id" attrs="{'required':[('holiday_type','=','employee')], 'invisible':[('holiday_type','=','category')]}"/>
<field name="category_id" attrs="{'required':[('holiday_type','=','category')], 'readonly':[('state','!=','draft')], 'invisible':[('holiday_type','=','employee')]}"/>
<field name="department_id" attrs="{'readonly':['|', ('holiday_type','=','category'), ('state','not in' ,('draft', 'confirm'))]}"/>
</group>
<group>
<field name="holiday_status_id" on_change="onchange_sec_id(holiday_status_id)" context="{'employee_id':employee_id}"/>
<field name="number_of_days_temp"/>
</group>
</group>
<notebook>
<page string="General">
<group col="4">
<field name="double_validation" invisible="1"/>
<field name="manager_id"/>
<field name="manager_id2" attrs="{'invisible':[('double_validation', '!=', True)]}"/>
</group>
<field name="notes" placeholder="Add a reason..."/>
</page>
</notebook>
<group>
<field name="double_validation" invisible="1"/>
<field name="manager_id2" attrs="{'invisible':[('double_validation', '!=', True)]}"/>
</group>
<field name="name"/>
</sheet>
<footer>
<field name="message_ids" colspan="4" widget="mail_thread" nolabel="1"/>
@@ -237,7 +224,6 @@
<field name="state"/>
</header>
<group col="4">
<field name="name"/>
<field name="holiday_status_id"/>
<field name="type"/>
<field name="date_from" on_change="onchange_date_from(date_to, date_from)" attrs="{'readonly':[('type','=','add')], 'required':[('type','=','remove')]}"/>
@@ -245,7 +231,7 @@
<field name="number_of_days_temp"/>
<field name="manager_id"/>
</group>
<field name="notes"/>
<field name="name"/>
</form>
</field>
</record>