Merge lp:~camptocamp/openobject-addons/7.0-fix-1188593 into lp:openobject-addons/7.0

Proposed by Nicolas Bessi - Camptocamp
Status: Needs review
Proposed branch: lp:~camptocamp/openobject-addons/7.0-fix-1188593
Merge into: lp:openobject-addons/7.0
Diff against target: 34 lines (+12/-3)
1 file modified
hr_timesheet_sheet/hr_timesheet_sheet.py (+12/-3)
To merge this branch: bzr merge lp:~camptocamp/openobject-addons/7.0-fix-1188593
Reviewer Review Type Date Requested Status
OpenERP Core Team Pending
Review via email: mp+168066@code.launchpad.net

Description of the change

fix bug 1188593
timesheet sheet name_search now supports monthly and daily timesheet range

To post a comment you must log in.
9206. By Nicolas Bessi - Camptocamp

[MRG] fix of hr_timesheet_sheet translation management name_get

Unmerged revisions

9206. By Nicolas Bessi - Camptocamp

[MRG] fix of hr_timesheet_sheet translation management name_get

9205. By Nicolas Bessi - Camptocamp

[FIX] bug 1188593 name_search now support monthly and daily timesheet range

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'hr_timesheet_sheet/hr_timesheet_sheet.py'
--- hr_timesheet_sheet/hr_timesheet_sheet.py 2013-05-08 08:59:38 +0000
+++ hr_timesheet_sheet/hr_timesheet_sheet.py 2013-06-17 12:38:29 +0000
@@ -198,13 +198,23 @@
198 return True198 return True
199199
200 def name_get(self, cr, uid, ids, context=None):200 def name_get(self, cr, uid, ids, context=None):
201 user = self.pool['res.users'].browse(cr, uid, uid, context=context)
202 tm_range = user.company_id.timesheet_range or 'month'
203 if tm_range == 'week':
204 tformat = _('Week %U')
205 elif tm_range == 'month':
206 tformat = _('Month %m')
207 elif tm_range == 'day':
208 tformat = user.lang.date_format if user.lang.date_format else '%Y-%m-%d'
209 else:
210 raise ValueError(_('Unsupported timesheet range: %s') % tm_range)
201 if not ids:211 if not ids:
202 return []212 return []
203 if isinstance(ids, (long, int)):213 if isinstance(ids, (long, int)):
204 ids = [ids]214 ids = [ids]
205 return [(r['id'], _('Week ')+datetime.strptime(r['date_from'], '%Y-%m-%d').strftime('%U')) \215 return [(r['id'], datetime.strptime(r['date_from'], '%Y-%m-%d').strftime(tformat))
206 for r in self.read(cr, uid, ids, ['date_from'],216 for r in self.read(cr, uid, ids, ['date_from'],
207 context=context, load='_classic_write')]217 context=context, load='_classic_write')]
208218
209 def unlink(self, cr, uid, ids, context=None):219 def unlink(self, cr, uid, ids, context=None):
210 sheets = self.read(cr, uid, ids, ['state','total_attendance'], context=context)220 sheets = self.read(cr, uid, ids, ['state','total_attendance'], context=context)
@@ -555,4 +565,3 @@
555res_company()565res_company()
556566
557# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:567# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
558