Ravi Gohil (OpenERP) has proposed merging
lp:~openerp-dev/openobject-addons/6.1-opw-578618-rgo into
lp:openobject-addons/6.1.
Requested reviews:
Naresh(OpenERP) (nch-openerp)
For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/6.1-opw-578618-rgo/+merge/123495
Steps to reproduce(After installing modules (hr_timesheet, hr_attendance)),
1) Install lang other than English,
2) Goto menu: `Human Resources --> Attendances`, and process `Sign in / Sign
out` and `Sign in / Sign out by project` wizards,
You will find values for `state` field as `absent` and `present` which should
be translated. The reason it isn't translated is, the value for `state` is
fetched like `employee.state` where `employee` is browse_record for
`hr.employee` object and `state` is selection field in it, so, `employee.state`
will result in fetching keys of `state` field of `hr.employee` object.
This fix will enable translation for these two words by replacing keys with
string.
Kindly review the fix.
Thanks.
--
https://code.launchpad.net/~openerp-dev/openobject-addons/6.1-opw-578618-rgo/+merge/123495
Your team OpenERP R&D Team is subscribed to branch
lp:~openerp-dev/openobject-addons/6.1-opw-578618-rgo.
=== modified file 'hr_attendance/wizard/hr_attendance_sign_in_out.py'
--- hr_attendance/wizard/hr_attendance_sign_in_out.py 2011-11-09 18:12:56 +0000
+++ hr_attendance/wizard/hr_attendance_sign_in_out.py 2012-09-10 07:15:45 +0000
@@ -76,7 +76,10 @@
emp_id = context.get('emp_id', self.pool.get('hr.employee').search(cr, uid, [('user_id', '=', uid)], context=context))
if emp_id:
employee = self.pool.get('hr.employee').browse(cr, uid, emp_id, context=context)[0]
- return {'name': employee.name, 'state': employee.state, 'emp_id': emp_id[0]}
+ #Word `Absent` and `Present` is used only for display purpose, hence, making them translated,
+ #writing `employee.state` will set value for `state` field of current object with the key of `state` field(selection) of `hr.employee` object.
+ state = _('Present') if employee.state == 'present' else _('Absent')
+ return {'name': employee.name, 'state': state, 'emp_id': emp_id[0]}
return {}
def default_get(self, cr, uid, fields_list, context=None):
=== modified file 'hr_timesheet/wizard/hr_timesheet_sign_in_out.py'
--- hr_timesheet/wizard/hr_timesheet_sign_in_out.py 2011-12-21 10:52:14 +0000
+++ hr_timesheet/wizard/hr_timesheet_sign_in_out.py 2012-09-10 07:15:45 +0000
@@ -43,7 +43,10 @@
emp_ids = emp_obj.search(cr, uid, [('user_id', '=', uid)], context=context)
if emp_ids:
for employee in emp_obj.browse(cr, uid, emp_ids, context=context):
- return {'name': employee.name, 'state': employee.state, 'emp_id': emp_ids[0], 'server_date':time.strftime('%Y-%m-%d %H:%M:%S')}
+ #Word `Absent` and `Present` is used only for display purpose, hence, making them translated,
+ #writing `employee.state` will set value for `state` field of current object with the key of `state` field(selection) of `hr.employee` object.
+ state = _('Present') if employee.state == 'present' else _('Absent')
+ return {'name': employee.name, 'state': state, 'emp_id': emp_ids[0], 'server_date':time.strftime('%Y-%m-%d %H:%M:%S')}
def _get_empid2(self, cr, uid, context=None):
res = self._get_empid(cr, uid, context=context)
@@ -165,7 +168,10 @@
emp_id = emp_obj.search(cr, uid, [('user_id', '=', uid)], context=context)
if emp_id:
for employee in emp_obj.browse(cr, uid, emp_id, context=context):
- res.update({'name': employee.name, 'state': employee.state, 'emp_id': emp_id[0], 'server_date':time.strftime('%Y-%m-%d %H:%M:%S')})
+ #Word `Absent` and `Present` is used only for display purpose, hence, making them translated,
+ #writing `employee.state` will set value for `state` field of current object with the key of `state` field(selection) of `hr.employee` object.
+ state = _('Present') if employee.state == 'present' else _('Absent')
+ res.update({'name': employee.name, 'state': state, 'emp_id': emp_id[0], 'server_date':time.strftime('%Y-%m-%d %H:%M:%S')})
return res
hr_si_project()
_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help : https://help.launchpad.net/ListHelp