[FIX] Hr_attendance : Button action calling corrected
bzr revid: jvo@tinyerp.com-20100118151410-maj5xsc2lsf8f9e0
This commit is contained in:
@@ -114,7 +114,11 @@ class hr_employee(osv.osv):
|
||||
def attendance_action_change(self, cr, uid, ids, type='action', context={}, dt=False, *args):
|
||||
id = False
|
||||
warning_sign = 'sign'
|
||||
|
||||
|
||||
#Special case when button calls this method :type=context
|
||||
if isinstance(type,dict):
|
||||
type = type.get('type','action')
|
||||
|
||||
if type == 'sign_in':
|
||||
warning_sign = "Sign In"
|
||||
elif type == 'sign_out':
|
||||
@@ -125,7 +129,7 @@ class hr_employee(osv.osv):
|
||||
raise osv.except_osv(_('Warning'), _('You tried to %s with a date anterior to another event !\nTry to contact the administrator to correct attendances.')%(warning_sign,))
|
||||
|
||||
res = {'action' : type, 'employee_id' : emp['id']}
|
||||
|
||||
|
||||
if dt:
|
||||
res['name'] = dt
|
||||
|
||||
|
||||
@@ -99,8 +99,8 @@
|
||||
<field name="arch" type="xml">
|
||||
<field name="parent_id" position="after">
|
||||
<field name="state"/>
|
||||
<button name="sign_in" states="absent" string="Sign In" type="object" icon="gtk-go-back"/>
|
||||
<button name="sign_out" states="present" string="Sign Out" type="object" icon="gtk-go-forward"/>
|
||||
<button name="attendance_action_change" states="absent" string="Sign In" type="object" icon="gtk-go-back" context="{'type':'sign_in'}"/>
|
||||
<button name="attendance_action_change" states="present" string="Sign Out" type="object" icon="gtk-go-forward" context="{'type':'sign_out'}"/>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
Reference in New Issue
Block a user