From 130f43b1d97493ce1e87e8d500a4af9889128654 Mon Sep 17 00:00:00 2001 From: Fabien Pinckaers <fp@tinyerp.com> Date: Mon, 18 Oct 2010 00:27:08 +0200 Subject: [PATCH] [FIX] misc fixes from xrg bzr revid: fp@tinyerp.com-20101017222708-71xbvzflx6pe797v --- addons/hr_attendance/report/attendance_by_month.py | 6 ++++-- addons/hr_attendance/report/timesheet.py | 5 ++++- addons/hr_evaluation/hr_evaluation.py | 4 ++-- addons/hr_holidays/hr_holidays.py | 3 +-- addons/hr_payroll/report/rml_parse.py | 4 ++-- addons/hr_payroll_account/hr_payroll_account.py | 7 +++---- addons/hr_recruitment/wizard/hr_recruitment_phonecall.py | 2 ++ addons/process/process.py | 6 +----- addons/wiki/web/widgets/wikimarkup/__init__.py | 7 ++++--- 9 files changed, 23 insertions(+), 21 deletions(-) diff --git a/addons/hr_attendance/report/attendance_by_month.py b/addons/hr_attendance/report/attendance_by_month.py index da761f3bb0c3..c8d0378b971b 100644 --- a/addons/hr_attendance/report/attendance_by_month.py +++ b/addons/hr_attendance/report/attendance_by_month.py @@ -80,11 +80,13 @@ class report_custom(report_rml): if attendences and attendences[-1]['action'] == 'sign_in': attendences.append({'name': tomor.strftime('%Y-%m-%d %H:%M:%S'), 'action':'sign_out'}) # sum up the attendances' durations + ldt = None for att in attendences: dt = datetime.strptime(att['name'], '%Y-%m-%d %H:%M:%S') - if att['action'] == 'sign_out': + if ldt and att['action'] == 'sign_out': wh += (dt - ldt).seconds/60/60 - ldt = dt + else: + ldt = dt # Week xml representation # wh = hour2str(wh) today_xml = '<day num="%s"><wh>%s</wh></day>' % ((today - month).days+1, round(wh,2)) diff --git a/addons/hr_attendance/report/timesheet.py b/addons/hr_attendance/report/timesheet.py index abedddd50c57..ff759fb3eaf4 100644 --- a/addons/hr_attendance/report/timesheet.py +++ b/addons/hr_attendance/report/timesheet.py @@ -79,10 +79,13 @@ class report_custom(report_rml): if attendances and attendances[-1]['action'] == 'sign_in': attendances.append({'name': n_monday.strftime('%Y-%m-%d %H:%M:%S'), 'action': 'sign_out'}) # sum up the attendances' durations + ldt = None for att in attendances: dt = datetime.strptime(att['name'], '%Y-%m-%d %H:%M:%S') - if att['action'] == 'sign_out': + if ldt and att['action'] == 'sign_out': week_wh[ldt.date().weekday()] = week_wh.get(ldt.date().weekday(), 0) + ((dt - ldt).seconds/3600) + else: + ldt = dt # Week xml representation week_repr = ['<week>', '<weekstart>%s</weekstart>' % monday.strftime('%Y-%m-%d'), '<weekend>%s</weekend>' % n_monday.strftime('%Y-%m-%d')] diff --git a/addons/hr_evaluation/hr_evaluation.py b/addons/hr_evaluation/hr_evaluation.py index 97f00d8b8612..20bd8a0b3276 100644 --- a/addons/hr_evaluation/hr_evaluation.py +++ b/addons/hr_evaluation/hr_evaluation.py @@ -235,12 +235,12 @@ class hr_evaluation(osv.osv): hr_eval_inter_obj.survey_req_waiting_answer(cr, uid, [int_id], context=context) if (not wait) and phase.mail_feature: - body = phase.mail_body % {'employee_name': child.name, 'user_signature': user.signature, + body = phase.mail_body % {'employee_name': child.name, 'user_signature': child.user_id.signature, 'eval_name': phase.survey_id.title, 'date': time.strftime('%Y-%m-%d'), 'time': time } sub = phase.email_subject dest = [child.work_email] if dest: - tools.email_send(src, dest, sub, body) + tools.email_send(evaluation.employee_id.work_email, dest, sub, body) self.write(cr, uid, ids, {'state':'wait'}, context=context) return True diff --git a/addons/hr_holidays/hr_holidays.py b/addons/hr_holidays/hr_holidays.py index eca3c02f3019..79710a569fba 100644 --- a/addons/hr_holidays/hr_holidays.py +++ b/addons/hr_holidays/hr_holidays.py @@ -240,8 +240,7 @@ class hr_holidays(osv.osv): if record.case_id: self.pool.get('crm.meeting').unlink(cr, uid, [record.case_id.id]) if record.linked_request_ids: - list_ids = [] - [list_ids.append(i) for id in record.linked_request_ids] + list_ids = [ lr.id for lr in record.linked_request_ids] self.holidays_cancel(cr, uid, list_ids) self.unlink(cr, uid, list_ids) diff --git a/addons/hr_payroll/report/rml_parse.py b/addons/hr_payroll/report/rml_parse.py index 7abb29711b61..0eb783de39fe 100755 --- a/addons/hr_payroll/report/rml_parse.py +++ b/addons/hr_payroll/report/rml_parse.py @@ -68,7 +68,7 @@ class rml_parse(report_sxw.rml_parse): def _get_and_change_date_format_for_swiss (self,date_to_format): date_formatted='' if date_to_format: - date_formatted = strptime (date_to_format,'%Y-%m-%d').strftime('%d.%m.%Y') + date_formatted = strptime(date_to_format,'%Y-%m-%d').strftime('%d.%m.%Y') return date_formatted def _explode_name(self,chaine,length): @@ -107,7 +107,7 @@ class rml_parse(report_sxw.rml_parse): return Stringer def explode_this(self,chaine,length): - chaine = rstrip(chaine) + chaine = chaine.rstrip() ast = list(chaine) i = length while i <= len(ast): diff --git a/addons/hr_payroll_account/hr_payroll_account.py b/addons/hr_payroll_account/hr_payroll_account.py index dcef94c3f359..d9f963ed5370 100644 --- a/addons/hr_payroll_account/hr_payroll_account.py +++ b/addons/hr_payroll_account/hr_payroll_account.py @@ -28,8 +28,6 @@ from osv import fields, osv from tools import config from tools.translate import _ - - def prev_bounds(cdate=False): when = date.fromtimestamp(time.mktime(time.strptime(cdate,"%Y-%m-%d"))) this_first = date(when.year, when.month, 1) @@ -572,8 +570,9 @@ class hr_payslip(osv.osv): line_ids += [movel_pool.create(cr, uid, rec, context=context)] - for contrub in line.category_id.contribute_ids: - print contrib.name, contrub.code, contrub.amount_type, contrib.contribute_per, line.total + # if self._debug: + # for contrib in line.category_id.contribute_ids: + # _log.debug("%s %s %s %s %s", contrib.name, contrub.code, contrub.amount_type, contrib.contribute_per, line.total) adj_move_id = False if total_deduct > 0: diff --git a/addons/hr_recruitment/wizard/hr_recruitment_phonecall.py b/addons/hr_recruitment/wizard/hr_recruitment_phonecall.py index 7cb5366a275c..6e817eaf49af 100644 --- a/addons/hr_recruitment/wizard/hr_recruitment_phonecall.py +++ b/addons/hr_recruitment/wizard/hr_recruitment_phonecall.py @@ -42,8 +42,10 @@ class job2phonecall(osv.osv_memory): return case.user_id and case.user_id.id or False def _date_category(self, cr, uid, context=None): + case_obj = self.pool.get('hr.applicant') if context is None: context = {} + case = case_obj.browse(cr, uid, context['active_id'], context=context) categ_id = self.pool.get('crm.case.categ').search(cr, uid, [('name','=','Outbound')], context=context) return categ_id and categ_id[0] or case.categ_id and case.categ_id.id or False diff --git a/addons/process/process.py b/addons/process/process.py index 479b8748ff30..544ff73e761a 100644 --- a/addons/process/process.py +++ b/addons/process/process.py @@ -30,16 +30,12 @@ class Env(dict): self.__usr = user def __getitem__(self, name): - if name in ('__obj', '__user'): - return super(ExprContext, self).__getitem__(name) - + return super(Env, self).__getitem__(name) if name == 'user': return self.__user - if name == 'object': return self.__obj - return self.__obj[name] class process_process(osv.osv): diff --git a/addons/wiki/web/widgets/wikimarkup/__init__.py b/addons/wiki/web/widgets/wikimarkup/__init__.py index 91fec4bc4fdc..5eceea0e86d6 100644 --- a/addons/wiki/web/widgets/wikimarkup/__init__.py +++ b/addons/wiki/web/widgets/wikimarkup/__init__.py @@ -455,7 +455,6 @@ class BaseParser(object): if hasattr(self, 'count'): data = self.env[namespace] test = key in data - ls self.count = True return key in self.env[namespace] @@ -1114,7 +1113,7 @@ class BaseParser(object): trail = url[i:] + trail url = url[0:i] - url = cleanURL(url) + url = self.cleanURL(url) sb.append(u'<a href="') sb.append(url) @@ -1978,7 +1977,9 @@ class Parser(BaseParser): if toclevel < wgMaxTocLevel: toc.append(u"</li>\n") toc.append(u"</ul>\n</li>\n" * max(0, toclevel - 1)) - toc.insert(0, u'<div id="toc"><h2>' + _('Table of Contents') + '</h2>') + #TODO: use gettext + #toc.insert(0, u'<div id="toc"><h2>' + _('Table of Contents') + '</h2>') + toc.insert(0, u'<div id="toc"><h2>Table of Contents</h2>') toc.append(u'</ul>\n</div>') # split up and insert constructed headlines -- GitLab