[IMP]base_setup,hr_holidays,POS:Improvement is Done

bzr revid: mma@tinyerp.com-20110516125031-wgqpw1lgrk0wv3ew
This commit is contained in:
mayur maheshwari (Open ERP) 2011-05-16 18:20:31 +05:30
parent 4a921c0e62
commit 67998c4c64
3 changed files with 21 additions and 14 deletions

View File

@ -217,13 +217,13 @@
<field name="type">form</field>
<field name="inherit_id" ref="base.view_company_form" />
<field name="arch" type="xml">
<field name="rml_footer2" position="after">
<newline/>
<separator string="" colspan="4"/>
<group colspan="4" col="2">
<button name="preview_report" string="Preview Report" type="object" icon="gtk-print"/>
</group>
</field>
<xpath expr="/form/notebook/page/field[@name='rml_header']" position="before">
<group colspan="4" col="8">
<label string="" colspan="7"/>
<button name="preview_report" string="Preview Report" type="object" icon="gtk-print"/>
</group>
<separator string="Header/Footer of Reports" colspan="4"/>
</xpath>
</field>
</record>

View File

@ -80,7 +80,7 @@ class hr_holidays_status(osv.osv):
'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, method=True, 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, method=True, string='Leaves Already Taken', help='This value is given by the sum of all holidays requests with a negative value.', multi='user_left_days'),
'remaining_leaves': fields.function(_user_left_days, method=True, string='Remaining Leaves', help='Maximum Leaves Allowed - Leaves Already Taken', multi='user_left_days'),
'remaining_leaves': fields.function(_user_left_days, method=True, string='Remaining Legal Leaves', help='Maximum Leaves Allowed - Leaves Already Taken', multi='user_left_days'),
'double_validation': fields.boolean('Apply Double Validation', help="If its True then its Allocation/Request have to be validated by second validator")
}
_defaults = {
@ -342,6 +342,11 @@ class hr_employee(osv.osv):
return True
def _get_remaining_days(self, cr, uid, ids, name, args, context=None):
type_obj = self.pool.get('hr.holidays.status')
status_ids = type_obj.search(cr, uid, [('limit', '=', False)], context=context)
len_s=len(status_ids)
if len_s != 1 :
raise osv.except_osv(('Warning !'),_("You should have only one leave type without allowing override limit. %s Found !") % (len_s))
cr.execute("SELECT sum(h.number_of_days_temp) as days, h.employee_id from hr_holidays h join hr_holidays_status s on (s.id=h.holiday_status_id) where h.type='add' and h.state='validate' and s.limit=False group by h.employee_id")
res = cr.dictfetchall()
remaining = {}

View File

@ -639,12 +639,14 @@
<field name="type">form</field>
<field name="inherit_id" ref="base.view_company_form"/>
<field name="arch" type="xml">
<notebook position="inside">
<page string="Other">
<field name="company_discount" colspan="4"/>
<field name="max_diff" colspan="4"/>
</page>
</notebook>
<page string="Configuration" position="inside">
<separator string="Other Information" colspan="4"/>
<group colspan="4" col="2" >
<field name="company_discount" />
<newline/>
<field name="max_diff" />
</group>
</page>
</field>
</record>