[FIX] hr_attendance:passed correct active_ids in report--author=Nikola Stojanoski

lp bug: https://launchpad.net/bugs/902391 fixed

bzr revid: hpa@tinyerp.com-20111216055238-8oyspotcv1ama5y1
This commit is contained in:
Hemendra Paregi (Open ERP) 2011-12-16 11:22:38 +05:30
parent 14ad417909
commit addf680273
2 changed files with 5 additions and 4 deletions

View File

@ -52,7 +52,7 @@ class report_custom(report_rml):
if context is None:
context = {}
month = datetime(datas['form']['year'], datas['form']['month'], 1)
emp_ids = context.get('active_ids', [])
emp_ids = datas['active_ids']
user_xml = ['<month>%s</month>' % _(month2name[month.month]), '<year>%s</year>' % month.year]
if emp_ids:
for emp in obj_emp.read(cr, uid, emp_ids, ['name']):
@ -96,7 +96,7 @@ class report_custom(report_rml):
days_xml.append(today_xml)
today, tomor = tomor, tomor + one_day
user_xml.append(user_repr % '\n'.join(days_xml))
rpt_obj = pooler.get_pool(cr.dbname).get('hr.employee')
rml_obj=report_sxw.rml_parse(cr, uid, rpt_obj._name,context)
header_xml = '''
@ -105,7 +105,7 @@ class report_custom(report_rml):
<company>%s</company>
</header>
''' % (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)
first_date = str(month)
som = datetime.strptime(first_date, '%Y-%m-%d %H:%M:%S')
eom = som + timedelta(int(dy)-1)
@ -130,7 +130,7 @@ class report_custom(report_rml):
month=som.month
month_dict[j]=som.strftime('%B')
width_dict[j]=cell
while day_diff1>0:
if month+i<=12:
if day_diff1 > lengthmonth(year,i+month): # Not on 30 else you have problems when entering 01-01-2009 for example

View File

@ -38,6 +38,7 @@ class hr_attendance_bymonth(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]
}