Merge lp:~openerp-dev/openobject-addons/6.1-opw-578618-rgo into lp:openobject-addons/6.1

Proposed by Ravi Gohil (OpenERP)
Status: Approved
Approved by: Naresh(OpenERP)
Approved revision: 6984
Proposed branch: lp:~openerp-dev/openobject-addons/6.1-opw-578618-rgo
Merge into: lp:openobject-addons/6.1
Diff against target: 43 lines (+12/-3)
2 files modified
hr_attendance/wizard/hr_attendance_sign_in_out.py (+4/-1)
hr_timesheet/wizard/hr_timesheet_sign_in_out.py (+8/-2)
To merge this branch: bzr merge lp:~openerp-dev/openobject-addons/6.1-opw-578618-rgo
Reviewer Review Type Date Requested Status
Naresh(OpenERP) (community) Approve
Review via email: mp+123495@code.launchpad.net

Description of the change

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.

To post a comment you must log in.
Revision history for this message
Naresh(OpenERP) (nch-openerp) :
review: Approve
Revision history for this message
Naresh(OpenERP) (nch-openerp) wrote :

Hello,

This bug was qualified as Confirmed on Trunk (means still existing and reproducible). A Merge Proposal for trunk was created to fix it. Here is the link to follow the MP on Launchpad https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-opw-578618-port-mma/+merge/135144 and be informed once it's been merged in trunk: ... If this Merge Proposal could not be merged in v6.1 at the release of v7.0, it will be closed.

Thanks,
Naresh Soni

Unmerged revisions

6984. By Ravi Gohil (OpenERP)

[FIX] hr: word 'absent' and 'present' isn't returned translated in wizards: (Maintenance Case : 578618)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== 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 @@
76 emp_id = context.get('emp_id', self.pool.get('hr.employee').search(cr, uid, [('user_id', '=', uid)], context=context))76 emp_id = context.get('emp_id', self.pool.get('hr.employee').search(cr, uid, [('user_id', '=', uid)], context=context))
77 if emp_id:77 if emp_id:
78 employee = self.pool.get('hr.employee').browse(cr, uid, emp_id, context=context)[0]78 employee = self.pool.get('hr.employee').browse(cr, uid, emp_id, context=context)[0]
79 return {'name': employee.name, 'state': employee.state, 'emp_id': emp_id[0]}79 #Word `Absent` and `Present` is used only for display purpose, hence, making them translated,
80 #writing `employee.state` will set value for `state` field of current object with the key of `state` field(selection) of `hr.employee` object.
81 state = _('Present') if employee.state == 'present' else _('Absent')
82 return {'name': employee.name, 'state': state, 'emp_id': emp_id[0]}
80 return {}83 return {}
8184
82 def default_get(self, cr, uid, fields_list, context=None):85 def default_get(self, cr, uid, fields_list, context=None):
8386
=== 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 @@
43 emp_ids = emp_obj.search(cr, uid, [('user_id', '=', uid)], context=context)43 emp_ids = emp_obj.search(cr, uid, [('user_id', '=', uid)], context=context)
44 if emp_ids:44 if emp_ids:
45 for employee in emp_obj.browse(cr, uid, emp_ids, context=context):45 for employee in emp_obj.browse(cr, uid, emp_ids, context=context):
46 return {'name': employee.name, 'state': employee.state, 'emp_id': emp_ids[0], 'server_date':time.strftime('%Y-%m-%d %H:%M:%S')}46 #Word `Absent` and `Present` is used only for display purpose, hence, making them translated,
47 #writing `employee.state` will set value for `state` field of current object with the key of `state` field(selection) of `hr.employee` object.
48 state = _('Present') if employee.state == 'present' else _('Absent')
49 return {'name': employee.name, 'state': state, 'emp_id': emp_ids[0], 'server_date':time.strftime('%Y-%m-%d %H:%M:%S')}
4750
48 def _get_empid2(self, cr, uid, context=None):51 def _get_empid2(self, cr, uid, context=None):
49 res = self._get_empid(cr, uid, context=context)52 res = self._get_empid(cr, uid, context=context)
@@ -165,7 +168,10 @@
165 emp_id = emp_obj.search(cr, uid, [('user_id', '=', uid)], context=context)168 emp_id = emp_obj.search(cr, uid, [('user_id', '=', uid)], context=context)
166 if emp_id:169 if emp_id:
167 for employee in emp_obj.browse(cr, uid, emp_id, context=context):170 for employee in emp_obj.browse(cr, uid, emp_id, context=context):
168 res.update({'name': employee.name, 'state': employee.state, 'emp_id': emp_id[0], 'server_date':time.strftime('%Y-%m-%d %H:%M:%S')})171 #Word `Absent` and `Present` is used only for display purpose, hence, making them translated,
172 #writing `employee.state` will set value for `state` field of current object with the key of `state` field(selection) of `hr.employee` object.
173 state = _('Present') if employee.state == 'present' else _('Absent')
174 res.update({'name': employee.name, 'state': state, 'emp_id': emp_id[0], 'server_date':time.strftime('%Y-%m-%d %H:%M:%S')})
169 return res175 return res
170176
171hr_si_project()177hr_si_project()