[FIX] misc fixes from xrg

bzr revid: fp@tinyerp.com-20101017222708-71xbvzflx6pe797v
This commit is contained in:
Fabien Pinckaers 2010-10-18 00:27:08 +02:00
parent ed5019c385
commit 130f43b1d9
9 changed files with 23 additions and 21 deletions

View File

@ -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))

View File

@ -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')]

View File

@ -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

View File

@ -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)

View File

@ -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):

View File

@ -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:

View File

@ -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

View File

@ -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):

View File

@ -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