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
1=== modified file 'hr_attendance/wizard/hr_attendance_sign_in_out.py'
2--- hr_attendance/wizard/hr_attendance_sign_in_out.py 2011-11-09 18:12:56 +0000
3+++ hr_attendance/wizard/hr_attendance_sign_in_out.py 2012-09-10 07:15:45 +0000
4@@ -76,7 +76,10 @@
5 emp_id = context.get('emp_id', self.pool.get('hr.employee').search(cr, uid, [('user_id', '=', uid)], context=context))
6 if emp_id:
7 employee = self.pool.get('hr.employee').browse(cr, uid, emp_id, context=context)[0]
8- return {'name': employee.name, 'state': employee.state, 'emp_id': emp_id[0]}
9+ #Word `Absent` and `Present` is used only for display purpose, hence, making them translated,
10+ #writing `employee.state` will set value for `state` field of current object with the key of `state` field(selection) of `hr.employee` object.
11+ state = _('Present') if employee.state == 'present' else _('Absent')
12+ return {'name': employee.name, 'state': state, 'emp_id': emp_id[0]}
13 return {}
14
15 def default_get(self, cr, uid, fields_list, context=None):
16
17=== modified file 'hr_timesheet/wizard/hr_timesheet_sign_in_out.py'
18--- hr_timesheet/wizard/hr_timesheet_sign_in_out.py 2011-12-21 10:52:14 +0000
19+++ hr_timesheet/wizard/hr_timesheet_sign_in_out.py 2012-09-10 07:15:45 +0000
20@@ -43,7 +43,10 @@
21 emp_ids = emp_obj.search(cr, uid, [('user_id', '=', uid)], context=context)
22 if emp_ids:
23 for employee in emp_obj.browse(cr, uid, emp_ids, context=context):
24- return {'name': employee.name, 'state': employee.state, 'emp_id': emp_ids[0], 'server_date':time.strftime('%Y-%m-%d %H:%M:%S')}
25+ #Word `Absent` and `Present` is used only for display purpose, hence, making them translated,
26+ #writing `employee.state` will set value for `state` field of current object with the key of `state` field(selection) of `hr.employee` object.
27+ state = _('Present') if employee.state == 'present' else _('Absent')
28+ return {'name': employee.name, 'state': state, 'emp_id': emp_ids[0], 'server_date':time.strftime('%Y-%m-%d %H:%M:%S')}
29
30 def _get_empid2(self, cr, uid, context=None):
31 res = self._get_empid(cr, uid, context=context)
32@@ -165,7 +168,10 @@
33 emp_id = emp_obj.search(cr, uid, [('user_id', '=', uid)], context=context)
34 if emp_id:
35 for employee in emp_obj.browse(cr, uid, emp_id, context=context):
36- res.update({'name': employee.name, 'state': employee.state, 'emp_id': emp_id[0], 'server_date':time.strftime('%Y-%m-%d %H:%M:%S')})
37+ #Word `Absent` and `Present` is used only for display purpose, hence, making them translated,
38+ #writing `employee.state` will set value for `state` field of current object with the key of `state` field(selection) of `hr.employee` object.
39+ state = _('Present') if employee.state == 'present' else _('Absent')
40+ res.update({'name': employee.name, 'state': state, 'emp_id': emp_id[0], 'server_date':time.strftime('%Y-%m-%d %H:%M:%S')})
41 return res
42
43 hr_si_project()