openerp-india team mailing list archive
-
openerp-india team
-
Mailing list archive
-
Message #24768
[Bug 1215895] [NEW] Wrong week displayed in hr_timesheet_sheet
Public bug reported:
When i go to [Human Resources] -> [My Current Timesheet], I see the
wrong week number in the title. For example this week is the 34th of
this year but 33 is displayed.
I found out why: Python starts with 0 (zero) when fetching the current
week by using strftime('%U').
I fixed this by returning the following value in
hr_timesheet_sheet.name_get() instead of the old return value:
[code]return [(r['id'], _('Week ')+str(int(datetime.strptime(r['date_from'], '%Y-%m-%d').strftime('%U')) + 1)) \
for r in self.read(cr, uid, ids, ['date_from'],
context=context, load='_classic_write')][/code]
I attached a module for fixing this issue.
** Affects: openobject-addons
Importance: Undecided
Status: New
** Patch added: "de_brainchild_timesheet_week_fix.tar.gz"
https://bugs.launchpad.net/bugs/1215895/+attachment/3784158/+files/de_brainchild_timesheet_week_fix.tar.gz
--
You received this bug notification because you are a member of OpenERP
Indian Team, which is subscribed to OpenERP Addons.
https://bugs.launchpad.net/bugs/1215895
Title:
Wrong week displayed in hr_timesheet_sheet
Status in OpenERP Addons (modules):
New
Bug description:
When i go to [Human Resources] -> [My Current Timesheet], I see the
wrong week number in the title. For example this week is the 34th of
this year but 33 is displayed.
I found out why: Python starts with 0 (zero) when fetching the current
week by using strftime('%U').
I fixed this by returning the following value in
hr_timesheet_sheet.name_get() instead of the old return value:
[code]return [(r['id'], _('Week ')+str(int(datetime.strptime(r['date_from'], '%Y-%m-%d').strftime('%U')) + 1)) \
for r in self.read(cr, uid, ids, ['date_from'],
context=context, load='_classic_write')][/code]
I attached a module for fixing this issue.
To manage notifications about this bug go to:
https://bugs.launchpad.net/openobject-addons/+bug/1215895/+subscriptions
Follow ups
References