diff --git a/addons/hr_timesheet/report/user_timesheet.py b/addons/hr_timesheet/report/user_timesheet.py index 404876b029d..4d1d5f428cf 100644 --- a/addons/hr_timesheet/report/user_timesheet.py +++ b/addons/hr_timesheet/report/user_timesheet.py @@ -35,10 +35,10 @@ def lengthmonth(year, month): class report_custom(report_rml): - def get_month_name(self, cr, uid, month): + def get_month_name(self, cr, uid, month, context=None): _months = {1:_("January"), 2:_("February"), 3:_("March"), 4:_("April"), 5:_("May"), 6:_("June"), 7:_("July"), 8:_("August"), 9:_("September"), 10:_("October"), 11:_("November"), 12:_("December")} return _months[month] - def get_weekday_name(self, cr, uid, weekday): + def get_weekday_name(self, cr, uid, weekday, context=None): _weekdays = {1:_('Mon'), 2:_('Tue'), 3:_('Wed'), 4:_('Thu'), 5:_('Fri'), 6:_('Sat'), 7:_('Sun')} return _weekdays[weekday] @@ -54,8 +54,8 @@ class report_custom(report_rml): som = datetime.date(data['form']['year'], data['form']['month'], 1) eom = som + datetime.timedelta(lengthmonth(som.year, som.month)) - date_xml = ['' % (self.get_month_name(cr, uid, som.month), som.year), ''] - date_xml += ['' % (x, self.get_weekday_name(cr, uid, som.replace(day=x).weekday()+1), som.replace(day=x).weekday()+1) for x in range(1, lengthmonth(som.year, som.month)+1)] + date_xml = ['' % (self.get_month_name(cr, uid, som.month, context=context), som.year), ''] + date_xml += ['' % (x, self.get_weekday_name(cr, uid, som.replace(day=x).weekday()+1, context=context), som.replace(day=x).weekday()+1) for x in range(1, lengthmonth(som.year, som.month)+1)] date_xml.append('') date_xml.append('2.5cm%s,2cm\n' % (',0.7cm' * lengthmonth(som.year, som.month))) diff --git a/addons/hr_timesheet/report/users_timesheet.py b/addons/hr_timesheet/report/users_timesheet.py index f7f78d72fd7..e6b366d627a 100644 --- a/addons/hr_timesheet/report/users_timesheet.py +++ b/addons/hr_timesheet/report/users_timesheet.py @@ -68,11 +68,11 @@ def emp_create_xml(cr, id, som, eom, emp): class report_custom(report_rml): - def get_month_name(self, cr, uid, month): + def get_month_name(self, cr, uid, month, context=None): _months = {1:_("January"), 2:_("February"), 3:_("March"), 4:_("April"), 5:_("May"), 6:_("June"), 7:_("July"), 8:_("August"), 9:_("September"), 10:_("October"), 11:_("November"), 12:_("December")} return _months[month] - def get_weekday_name(self, cr, uid, weekday): + def get_weekday_name(self, cr, uid, weekday, context=None): _weekdays = {1:_('Mon'), 2:_('Tue'), 3:_('Wed'), 4:_('Thu'), 5:_('Fri'), 6:_('Sat'), 7:_('Sun')} return _weekdays[weekday] @@ -81,8 +81,8 @@ class report_custom(report_rml): # Computing the dates (start of month: som, and end of month: eom) som = datetime.date(data['form']['year'], data['form']['month'], 1) eom = som + datetime.timedelta(lengthmonth(som.year, som.month)) - date_xml = ['' % (self.get_month_name(cr, uid, som.month), som.year), ''] - date_xml += ['' % (x, self.get_weekday_name(cr, uid, som.replace(day=x).weekday()+1), som.replace(day=x).weekday()+1) for x in range(1, lengthmonth(som.year, som.month)+1)] + date_xml = ['' % (self.get_month_name(cr, uid, som.month, context=context), som.year), ''] + date_xml += ['' % (x, self.get_weekday_name(cr, uid, som.replace(day=x).weekday()+1, context=context), som.replace(day=x).weekday()+1) for x in range(1, lengthmonth(som.year, som.month)+1)] date_xml.append('') date_xml.append('2.5cm%s,2cm\n' % (',0.7cm' * lengthmonth(som.year, som.month)))