diff --git a/addons/hr_attendance/report/attendance_by_month.py b/addons/hr_attendance/report/attendance_by_month.py index fe6d09a6084..f104b9c287a 100644 --- a/addons/hr_attendance/report/attendance_by_month.py +++ b/addons/hr_attendance/report/attendance_by_month.py @@ -57,6 +57,7 @@ class report_custom(report_rml): if emp_ids: for emp in obj_emp.read(cr, uid, emp_ids, ['name']): stop, days_xml = False, [] + total_wh = 0.0 user_repr = ''' %s @@ -92,11 +93,15 @@ class report_custom(report_rml): else: ldt = dt # Week xml representation + total_wh += wh wh = hour2str(wh) today_xml = '%s' % ((today - month).days+1, (wh)) dy=(today - month).days+1 days_xml.append(today_xml) today, tomor = tomor, tomor + one_day + total_wh = hour2str(total_wh) + today_xml = '%s' % (total_wh) + days_xml.append(today_xml) user_xml.append(user_repr % '\n'.join(days_xml)) rpt_obj = pooler.get_pool(cr.dbname).get('hr.employee') @@ -174,8 +179,9 @@ class report_custom(report_rml): cell=cell+x width_dict[j]=x day_diff1=day_diff1-x + date_xml += [''] date_xml.append('') - date_xml.append('3.5cm%s\n' % (',0.74cm' * (int(dy)))) + date_xml.append('3.5cm%s,1.2cm\n' % (',0.74cm' * (int(dy)))) xml = ''' %s @@ -183,7 +189,7 @@ class report_custom(report_rml): %s %s - ''' % (header_xml,_('Attendances By Month'),'\n'.join(user_xml),date_xml) + ''' % (header_xml,_('Attendances by Month'),'\n'.join(user_xml),date_xml) return xml report_custom('report.hr.attendance.bymonth', 'hr.employee', '', 'addons/hr_attendance/report/bymonth.xsl') diff --git a/addons/hr_attendance/report/timesheet.py b/addons/hr_attendance/report/timesheet.py index 326ffce63e0..5df1bae4dba 100644 --- a/addons/hr_attendance/report/timesheet.py +++ b/addons/hr_attendance/report/timesheet.py @@ -20,12 +20,15 @@ ############################################################################## +import time from datetime import datetime from dateutil.relativedelta import relativedelta import pooler from report.interface import report_rml from report.interface import toxml +from report import report_sxw +from tools.translate import _ import tools one_week = relativedelta(days=7) @@ -38,7 +41,8 @@ class report_custom(report_rml): def create_xml(self, cr, uid, ids, datas, context=None): obj_emp = pooler.get_pool(cr.dbname).get('hr.employee') - ids = datas['active_ids'] + + emp_ids = datas['active_ids'] start_date = datetime.strptime(datas['form']['init_date'], '%Y-%m-%d') end_date = datetime.strptime(datas['form']['end_date'], '%Y-%m-%d') first_monday = start_date - relativedelta(days=start_date.date().weekday()) @@ -47,9 +51,16 @@ class report_custom(report_rml): if last_monday < first_monday: first_monday, last_monday = last_monday, first_monday + rpt_obj = pooler.get_pool(cr.dbname).get('hr.employee') + rml_obj=report_sxw.rml_parse(cr, uid, rpt_obj._name,context) + header_xml = ''' +
+ %s + %s +
+ ''' % (str(rml_obj.formatLang(time.strftime("%Y-%m-%d"),date=True))+' ' + str(time.strftime("%H:%M")),pooler.get_pool(cr.dbname).get('res.users').browse(cr,uid,uid).company_id.name) user_xml = [] - - for employee_id in ids: + for employee_id in emp_ids: emp = obj_emp.read(cr, uid, [employee_id], ['id', 'name'])[0] monday, n_monday = first_monday, first_monday + one_week stop, week_xml = False, [] @@ -88,7 +99,7 @@ class report_custom(report_rml): ldt = dt # Week xml representation - week_repr = ['', '%s' % monday.strftime('%Y-%m-%d'), '%s' % n_monday.strftime('%Y-%m-%d')] + week_repr = ['', '%s' % monday.strftime('%Y-%m-%d'), '%s' % (n_monday - relativedelta(days=1)).strftime('%Y-%m-%d')] for idx in range(7): week_repr.append('<%s>' % num2day[idx]) if idx in week_wh: @@ -98,17 +109,17 @@ class report_custom(report_rml): week_repr.append('%sh%02d' % to_hour(reduce(lambda x,y:x+y, week_wh.values(), 0))) week_repr.append('') week_repr.append('') - if len(week_repr) > 21: # 21 = minimal length of week_repr - week_xml.append('\n'.join(week_repr)) + week_xml.append('\n'.join(week_repr)) monday, n_monday = n_monday, n_monday + one_week user_xml.append(user_repr % '\n'.join(week_xml)) - xml = ''' %s + %s + %s - ''' % '\n'.join(user_xml) + ''' % (header_xml,_('Attendances by Week'),'\n'.join(user_xml)) xml = tools.ustr(xml).encode('utf8') return self.post_process_xml_data(cr, uid, xml, context) diff --git a/addons/hr_attendance/report/timesheet.xsl b/addons/hr_attendance/report/timesheet.xsl index f815c0880fc..4d113512801 100644 --- a/addons/hr_attendance/report/timesheet.xsl +++ b/addons/hr_attendance/report/timesheet.xsl @@ -3,12 +3,15 @@ xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format"> + + + - + + + - - - - + + + + + + + + @@ -36,32 +45,37 @@ + + + + + + + + + - - Name: + + + Employee: - - - - Mon - Tue - Wed - Thu - Fri - Sat - Sun - Tot - - - + + + - Week: - - from to + From to + Mon + Tue + Wed + Thu + Fri + Sat + Sun + Total Worked hours @@ -70,7 +84,7 @@ - 0 + 0h00 @@ -78,7 +92,7 @@ - 0 + 0h00 @@ -86,7 +100,7 @@ - 0 + 0h00 @@ -94,7 +108,7 @@ - 0 + 0h00 @@ -102,7 +116,7 @@ - 0 + 0h00 @@ -110,7 +124,7 @@ - 0 + 0h00 @@ -118,14 +132,24 @@ - 0 + 0h00 - - + + + + + + + + + + + + diff --git a/addons/hr_attendance/wizard/hr_attendance_byweek.py b/addons/hr_attendance/wizard/hr_attendance_byweek.py index 454ba7764da..420773eaf13 100644 --- a/addons/hr_attendance/wizard/hr_attendance_byweek.py +++ b/addons/hr_attendance/wizard/hr_attendance_byweek.py @@ -18,7 +18,8 @@ # along with this program. If not, see . # ############################################################################## -import time +from datetime import datetime +from dateutil.relativedelta import relativedelta from osv import osv, fields @@ -30,8 +31,8 @@ class hr_attendance_byweek(osv.osv_memory): 'end_date': fields.date('Ending Date', required=True) } _defaults = { - 'init_date': lambda *a: time.strftime('%Y-%m-%d'), - 'end_date': lambda *a: time.strftime('%Y-%m-%d'), + 'init_date': (datetime.today() - relativedelta(days=datetime.date(datetime.today()).weekday())).strftime('%Y-%m-%d'), + 'end_date': (datetime.today() + relativedelta(days=6 - datetime.date(datetime.today()).weekday())).strftime('%Y-%m-%d'), } def print_report(self, cr, uid, ids, context=None): diff --git a/addons/hr_holidays/hr_holidays_view.xml b/addons/hr_holidays/hr_holidays_view.xml index 7ccace1c536..e92679e0bad 100644 --- a/addons/hr_holidays/hr_holidays_view.xml +++ b/addons/hr_holidays/hr_holidays_view.xml @@ -46,7 +46,7 @@ - + diff --git a/addons/hr_recruitment/hr_recruitment.py b/addons/hr_recruitment/hr_recruitment.py index 049cb93ca1e..48867d3522f 100644 --- a/addons/hr_recruitment/hr_recruitment.py +++ b/addons/hr_recruitment/hr_recruitment.py @@ -235,7 +235,6 @@ class hr_applicant(base_stage, osv.Model): 'email_from': lambda s, cr, uid, c: s._get_default_email(cr, uid, c), 'stage_id': lambda s, cr, uid, c: s._get_default_stage_id(cr, uid, c), 'department_id': lambda s, cr, uid, c: s._get_default_department_id(cr, uid, c), - 'priority': lambda *a: '', 'company_id': lambda s, cr, uid, c: s.pool.get('res.company')._company_default_get(cr, uid, 'hr.applicant', context=c), 'color': 0, } diff --git a/addons/hr_timesheet_sheet/hr_timesheet_sheet.py b/addons/hr_timesheet_sheet/hr_timesheet_sheet.py index a9276ba6984..bf6790c6be3 100644 --- a/addons/hr_timesheet_sheet/hr_timesheet_sheet.py +++ b/addons/hr_timesheet_sheet/hr_timesheet_sheet.py @@ -70,7 +70,7 @@ class hr_timesheet_sheet(osv.osv): if not self.pool.get('hr.employee').browse(cr, uid, vals['employee_id']).product_id: raise osv.except_osv(_('Error!'), _('In order to create a timesheet for this employee, you must link the employee to a product, like \'Consultant\'.')) if not self.pool.get('hr.employee').browse(cr, uid, vals['employee_id']).journal_id: - raise osv.except_osv(_('Error!'), _('In order to create a timesheet for this employee, you must assign the employee to an analytic journal, like \'Timesheet\'.')) + raise osv.except_osv(_('Configuration Error!'), _('In order to create a timesheet for this employee, you must assign an analytic journal to the employee, like \'Timesheet Journal\'.')) return super(hr_timesheet_sheet, self).create(cr, uid, vals, *args, **argv) def write(self, cr, uid, ids, vals, *args, **argv): @@ -83,7 +83,7 @@ class hr_timesheet_sheet(osv.osv): if not self.pool.get('hr.employee').browse(cr, uid, vals['employee_id']).product_id: raise osv.except_osv(_('Error!'), _('In order to create a timesheet for this employee, you must link the employee to a product.')) if not self.pool.get('hr.employee').browse(cr, uid, vals['employee_id']).journal_id: - raise osv.except_osv(_('Error!'), _('In order to create a timesheet for this employee, you must assign the employee to an analytic journal.')) + raise osv.except_osv(_('Configuration Error!'), _('In order to create a timesheet for this employee, you must assign an analytic journal to the employee, like \'Timesheet Journal\'.')) return super(hr_timesheet_sheet, self).write(cr, uid, ids, vals, *args, **argv) def button_confirm(self, cr, uid, ids, context=None):