From 142253b76ea337cf0b8444f4a62a06e01d622c30 Mon Sep 17 00:00:00 2001 From: "Ajay Chauhan (OpenERP)" Date: Thu, 11 Oct 2012 17:50:36 +0530 Subject: [PATCH 01/13] [IMP] hr_timesheet_sheet: made changes in warning message bzr revid: cha@tinyerp.com-20121011122036-ff1kevlg121t2yz7 --- addons/hr_timesheet_sheet/hr_timesheet_sheet.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/hr_timesheet_sheet/hr_timesheet_sheet.py b/addons/hr_timesheet_sheet/hr_timesheet_sheet.py index 96cb15ddce1..5b5c323e4f5 100644 --- a/addons/hr_timesheet_sheet/hr_timesheet_sheet.py +++ b/addons/hr_timesheet_sheet/hr_timesheet_sheet.py @@ -151,7 +151,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): @@ -164,7 +164,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.')) return super(hr_timesheet_sheet, self).write(cr, uid, ids, vals, *args, **argv) def button_confirm(self, cr, uid, ids, context=None): From 728644807fd2ce41eb121cd789cb6998ff74744a Mon Sep 17 00:00:00 2001 From: "Ajay Chauhan (OpenERP)" Date: Thu, 11 Oct 2012 18:51:18 +0530 Subject: [PATCH 02/13] [IMP] hr_recruitment: solved group by Appreciation in for application bzr revid: cha@tinyerp.com-20121011132118-x2n3gds5571q5v1d --- addons/hr_recruitment/hr_recruitment.py | 1 - 1 file changed, 1 deletion(-) diff --git a/addons/hr_recruitment/hr_recruitment.py b/addons/hr_recruitment/hr_recruitment.py index ccfcae0d26e..3031638c17f 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, } From da96d4f3852774e1096dccc440462f1643a0fe49 Mon Sep 17 00:00:00 2001 From: "Ajay Chauhan (OpenERP)" Date: Fri, 12 Oct 2012 11:05:35 +0530 Subject: [PATCH 03/13] [IMP] hr_holidays: made records with 'Second Approval' state visible in menu 'Leave Requests to Approve' bzr revid: cha@tinyerp.com-20121012053535-qtcu2o3hw60ys2r3 --- addons/hr_holidays/hr_holidays_view.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/hr_holidays/hr_holidays_view.xml b/addons/hr_holidays/hr_holidays_view.xml index ae85b03fcaf..f9b789b2421 100644 --- a/addons/hr_holidays/hr_holidays_view.xml +++ b/addons/hr_holidays/hr_holidays_view.xml @@ -46,7 +46,7 @@ - + From ece648faed2ce53cda0c599daadae44ff5b7246a Mon Sep 17 00:00:00 2001 From: "Ajay Chauhan (OpenERP)" Date: Mon, 15 Oct 2012 15:00:09 +0530 Subject: [PATCH 04/13] [IMP] hr_attendance: added column for total in 'Attendance by Month' report bzr revid: cha@tinyerp.com-20121015093009-69xzo9iutecnhnc5 --- addons/hr_attendance/report/attendance_by_month.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/addons/hr_attendance/report/attendance_by_month.py b/addons/hr_attendance/report/attendance_by_month.py index 17cf548345e..950f6ad0912 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 @@ -90,11 +91,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') @@ -172,8 +177,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 From bac6c2151f9f3138b18ec1e49adce593383181c6 Mon Sep 17 00:00:00 2001 From: "Ajay Chauhan (OpenERP)" Date: Tue, 16 Oct 2012 12:56:35 +0530 Subject: [PATCH 05/13] [IMP] hr_attendance: made report visible & added header in 'Attendance by Week' report bzr revid: cha@tinyerp.com-20121016072635-aqx7jmysakwkg7fz --- addons/hr_attendance/report/timesheet.py | 20 +++++++++++++++---- addons/hr_attendance/report/timesheet.xsl | 16 ++++++++++++++- .../wizard/hr_attendance_byweek.py | 1 + 3 files changed, 32 insertions(+), 5 deletions(-) diff --git a/addons/hr_attendance/report/timesheet.py b/addons/hr_attendance/report/timesheet.py index 900f982dc74..58c8efe6991 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) @@ -39,6 +42,7 @@ 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') + 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, [] @@ -103,12 +114,13 @@ class report_custom(report_rml): 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..bd3d596e34c 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,9 +40,19 @@ + + + + + + + + + + Name: diff --git a/addons/hr_attendance/wizard/hr_attendance_byweek.py b/addons/hr_attendance/wizard/hr_attendance_byweek.py index 9ee69a937d1..454ba7764da 100644 --- a/addons/hr_attendance/wizard/hr_attendance_byweek.py +++ b/addons/hr_attendance/wizard/hr_attendance_byweek.py @@ -37,6 +37,7 @@ class hr_attendance_byweek(osv.osv_memory): def print_report(self, cr, uid, ids, context=None): datas = { 'ids': [], + 'active_ids': context['active_ids'], 'model': 'hr.employee', 'form': self.read(cr, uid, ids)[0] } From 12246cfb2b84d0f23556756de2f4a8c13463ff17 Mon Sep 17 00:00:00 2001 From: "Ajay Chauhan (OpenERP)" Date: Mon, 22 Oct 2012 12:32:15 +0530 Subject: [PATCH 06/13] [IMP] hr_timesheet_sheet: made little change in warning message bzr revid: cha@tinyerp.com-20121022070215-y87h55i1h8fuljuf --- addons/hr_timesheet_sheet/hr_timesheet_sheet.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/hr_timesheet_sheet/hr_timesheet_sheet.py b/addons/hr_timesheet_sheet/hr_timesheet_sheet.py index 6d4db093cca..b98833e549b 100644 --- a/addons/hr_timesheet_sheet/hr_timesheet_sheet.py +++ b/addons/hr_timesheet_sheet/hr_timesheet_sheet.py @@ -164,7 +164,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(_('Configuration Error!'), _('In order to create a timesheet for this employee, you must assign an analytic journal to the employee.')) + 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): From d9900b497a05c753117ca11b8c18afc783709248 Mon Sep 17 00:00:00 2001 From: "Ajay Chauhan (OpenERP)" Date: Tue, 23 Oct 2012 17:29:29 +0530 Subject: [PATCH 07/13] [IMP] hr_attendance: made little change in header of report bzr revid: cha@tinyerp.com-20121023115929-enc932x4kdk077i4 --- addons/hr_attendance/report/attendance_by_month.py | 2 +- addons/hr_attendance/report/timesheet.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/hr_attendance/report/attendance_by_month.py b/addons/hr_attendance/report/attendance_by_month.py index cdb2d709444..236655bcac0 100644 --- a/addons/hr_attendance/report/attendance_by_month.py +++ b/addons/hr_attendance/report/attendance_by_month.py @@ -189,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 58c8efe6991..f5d3ff07d2c 100644 --- a/addons/hr_attendance/report/timesheet.py +++ b/addons/hr_attendance/report/timesheet.py @@ -120,7 +120,7 @@ class report_custom(report_rml): %s %s - ''' % (header_xml,_('Attendances By Week'),'\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) From 4288a65ccf266892f86632a9039cca44e2de901c Mon Sep 17 00:00:00 2001 From: "Ajay Chauhan (OpenERP)" Date: Mon, 29 Oct 2012 14:32:35 +0530 Subject: [PATCH 08/13] [IMP] hr_attendance: add 'Total' label in another row in report bzr revid: cha@tinyerp.com-20121029090235-ltcg4rmgu8jrnt9d --- addons/hr_attendance/report/attendance_by_month.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/hr_attendance/report/attendance_by_month.py b/addons/hr_attendance/report/attendance_by_month.py index 236655bcac0..f104b9c287a 100644 --- a/addons/hr_attendance/report/attendance_by_month.py +++ b/addons/hr_attendance/report/attendance_by_month.py @@ -179,7 +179,7 @@ class report_custom(report_rml): cell=cell+x width_dict[j]=x day_diff1=day_diff1-x - date_xml += [''] + date_xml += [''] date_xml.append('') date_xml.append('3.5cm%s,1.2cm\n' % (',0.74cm' * (int(dy)))) xml = ''' From 4f555e059fd450060a994d11ea7c62d9965cc6e2 Mon Sep 17 00:00:00 2001 From: "Ajay Chauhan (OpenERP)" Date: Tue, 30 Oct 2012 12:17:07 +0530 Subject: [PATCH 09/13] [IMP] hr_attendance: made lines visible even if employee is absent for whole week bzr revid: cha@tinyerp.com-20121030064707-m12g44n2i9q8eun0 --- addons/hr_attendance/report/timesheet.py | 3 +-- addons/hr_attendance/report/timesheet.xsl | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/addons/hr_attendance/report/timesheet.py b/addons/hr_attendance/report/timesheet.py index f5d3ff07d2c..04ebf62755e 100644 --- a/addons/hr_attendance/report/timesheet.py +++ b/addons/hr_attendance/report/timesheet.py @@ -109,8 +109,7 @@ 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)) diff --git a/addons/hr_attendance/report/timesheet.xsl b/addons/hr_attendance/report/timesheet.xsl index bd3d596e34c..1bb5539fb34 100644 --- a/addons/hr_attendance/report/timesheet.xsl +++ b/addons/hr_attendance/report/timesheet.xsl @@ -68,7 +68,7 @@ Fri Sat Sun - Tot + Total From 42df1b6c070e5c394383d49fa4e70465719b3e2f Mon Sep 17 00:00:00 2001 From: "Ajay Chauhan (OpenERP)" Date: Thu, 1 Nov 2012 19:17:13 +0530 Subject: [PATCH 10/13] [IMP] hr_attendance: change formatting of 'Attendance by week' report bzr revid: cha@tinyerp.com-20121101134713-ru850hpdj8w914ji --- addons/hr_attendance/report/timesheet.xsl | 76 +++++++++++++---------- 1 file changed, 43 insertions(+), 33 deletions(-) diff --git a/addons/hr_attendance/report/timesheet.xsl b/addons/hr_attendance/report/timesheet.xsl index 1bb5539fb34..aea4a450a0f 100644 --- a/addons/hr_attendance/report/timesheet.xsl +++ b/addons/hr_attendance/report/timesheet.xsl @@ -24,11 +24,16 @@ + - - - - + + + + + + + + @@ -42,7 +47,6 @@ - @@ -54,28 +58,24 @@ - - Name: + + + Employee: - - - - Mon - Tue - Wed - Thu - Fri - Sat - Sun - Total - - - + + + - Week: - - from to + From to + Mon + Tue + Wed + Thu + Fri + Sat + Sun + Total Worked hours @@ -84,7 +84,7 @@ - 0 + 0h00 @@ -92,7 +92,7 @@ - 0 + 0h00 @@ -100,7 +100,7 @@ - 0 + 0h00 @@ -108,7 +108,7 @@ - 0 + 0h00 @@ -116,7 +116,7 @@ - 0 + 0h00 @@ -124,7 +124,7 @@ - 0 + 0h00 @@ -132,14 +132,24 @@ - 0 + 0h00 - - + + + + + + + + + + + + From b0a204350fe1a123dd4cea28ddc4f06c5e405046 Mon Sep 17 00:00:00 2001 From: "Ajay Chauhan (OpenERP)" Date: Fri, 2 Nov 2012 12:09:33 +0530 Subject: [PATCH 11/13] [IMP] hr_attendance: change font-size in report bzr revid: cha@tinyerp.com-20121102063933-twdqxhomtnagygmv --- addons/hr_attendance/report/timesheet.xsl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/hr_attendance/report/timesheet.xsl b/addons/hr_attendance/report/timesheet.xsl index aea4a450a0f..4d113512801 100644 --- a/addons/hr_attendance/report/timesheet.xsl +++ b/addons/hr_attendance/report/timesheet.xsl @@ -26,8 +26,8 @@ - - + + From 18cbe267573edd50ef23d8420916c3cc5a04ab74 Mon Sep 17 00:00:00 2001 From: "Ajay Chauhan (OpenERP)" Date: Fri, 2 Nov 2012 14:35:24 +0530 Subject: [PATCH 12/13] [IMP] hr_attendance: set correct end date of week in report bzr revid: cha@tinyerp.com-20121102090524-32mzyakopzv7xka2 --- addons/hr_attendance/report/timesheet.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/hr_attendance/report/timesheet.py b/addons/hr_attendance/report/timesheet.py index 04ebf62755e..5df1bae4dba 100644 --- a/addons/hr_attendance/report/timesheet.py +++ b/addons/hr_attendance/report/timesheet.py @@ -99,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: From 67d88f64e17e838377bd2f0edb2dfb20f803310d Mon Sep 17 00:00:00 2001 From: "Ajay Chauhan (OpenERP)" Date: Fri, 2 Nov 2012 15:19:31 +0530 Subject: [PATCH 13/13] [IMP] hr_attendance: set default value of dates according to week bzr revid: cha@tinyerp.com-20121102094931-3os8m29tjm8tdnhs --- addons/hr_attendance/wizard/hr_attendance_byweek.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) 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):