diff --git a/addons/hr_timesheet/report/user_timesheet.py b/addons/hr_timesheet/report/user_timesheet.py
index b86a6e8e89d..63edf3cc398 100644
--- a/addons/hr_timesheet/report/user_timesheet.py
+++ b/addons/hr_timesheet/report/user_timesheet.py
@@ -20,12 +20,12 @@
##############################################################################
import datetime
+import time
+import openerp
from openerp.report.interface import report_rml
from openerp.report.interface import toxml
from openerp.tools.translate import _
-import time
-from openerp import pooler
from openerp.report import report_sxw
from openerp.tools import ustr
from openerp.tools import to_xml
@@ -45,10 +45,11 @@ class report_custom(report_rml):
return _weekdays[weekday]
def create_xml(self, cr, uid, ids, data, context):
+ registry = openerp.registry(cr.dbname)
# Get the user id from the selected employee record
emp_id = data['form']['employee_id']
- emp_obj = pooler.get_pool(cr.dbname).get('hr.employee')
+ emp_obj = registry['hr.employee']
user_id = emp_obj.browse(cr, uid, emp_id).user_id.id
empl_name = emp_obj.browse(cr, uid, emp_id).name
@@ -87,7 +88,7 @@ class report_custom(report_rml):
%.2f
'''
- rpt_obj = pooler.get_pool(cr.dbname).get('hr.employee')
+ rpt_obj = registry['hr.employee']
rml_obj = report_sxw.rml_parse(cr, uid, rpt_obj._name,context)
if user_id:
header_xml = '''
@@ -95,12 +96,12 @@ class report_custom(report_rml):
%s
%s
- ''' % (str(rml_obj.formatLang(time.strftime("%Y-%m-%d"),date=True))+' ' + str(time.strftime("%H:%M")),to_xml(pooler.get_pool(cr.dbname).get('res.users').browse(cr,uid,user_id).company_id.name))
+ ''' % (str(rml_obj.formatLang(time.strftime("%Y-%m-%d"),date=True))+' ' + str(time.strftime("%H:%M")),to_xml(registry['res.users'].browse(cr,uid,user_id).company_id.name))
account_xml = []
for account, telems in accounts.iteritems():
aid, aname = account
- aname = pooler.get_pool(cr.dbname).get('account.analytic.account').name_get(cr, uid, [aid], context)
+ aname = registry['account.analytic.account'].name_get(cr, uid, [aid], context)
aname = aname[0][1]
account_xml.append('' % (aid, toxml(aname)))
diff --git a/addons/hr_timesheet/report/users_timesheet.py b/addons/hr_timesheet/report/users_timesheet.py
index 4827994f2cd..d8c4927947d 100644
--- a/addons/hr_timesheet/report/users_timesheet.py
+++ b/addons/hr_timesheet/report/users_timesheet.py
@@ -20,10 +20,11 @@
##############################################################################
import datetime
+import time
+
+import openerp
from openerp.report.interface import report_rml
from openerp.report.interface import toxml
-import time
-from openerp import pooler
from openerp.tools.translate import _
from openerp.report import report_sxw
from openerp.tools import ustr
@@ -78,6 +79,7 @@ class report_custom(report_rml):
return _weekdays[weekday]
def create_xml(self, cr, uid, ids, data, context):
+ registry = openerp.registry(cr.dbname)
# Computing the dates (start of month: som, and end of month: eom)
som = datetime.date(data['form']['year'], data['form']['month'], 1)
@@ -88,7 +90,7 @@ class report_custom(report_rml):
date_xml.append('2.5cm%s,2cm\n' % (',0.7cm' * lengthmonth(som.year, som.month)))
emp_xml=''
- emp_obj = pooler.get_pool(cr.dbname).get('hr.employee')
+ emp_obj = registry['hr.employee']
for id in data['form']['employee_ids']:
user = emp_obj.browse(cr, uid, id).user_id.id
empl_name = emp_obj.browse(cr, uid, id).name
@@ -97,14 +99,14 @@ class report_custom(report_rml):
# Computing the xml
#Without this, report don't show non-ascii characters (TO CHECK)
date_xml = '\n'.join(date_xml)
- rpt_obj = pooler.get_pool(cr.dbname).get('hr.employee')
+ rpt_obj = emp_obj
rml_obj=report_sxw.rml_parse(cr, uid, rpt_obj._name,context)
header_xml = '''
- ''' % (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)
+ ''' % (str(rml_obj.formatLang(time.strftime("%Y-%m-%d"),date=True))+' ' + str(time.strftime("%H:%M")),registry['res.users'].browse(cr,uid,uid).company_id.name)
xml='''