[REF] service: some code was touching the internal of netsvc.Service so it has to be updated.

bzr revid: vmt@openerp.com-20130201112309-bjhu7jems82uk6bg
This commit is contained in:
Vo Minh Thu 2013-02-01 12:23:09 +01:00
parent b6531577d7
commit 69b23c9936
3 changed files with 9 additions and 8 deletions

View File

@ -31,11 +31,11 @@ from StringIO import StringIO
import psycopg2
import openerp
from openerp import netsvc
from openerp import pooler
from openerp import tools
from openerp.osv import fields, osv
from openerp.osv.orm import except_orm
import openerp.report.interface
from openerp.tools.misc import ustr
from openerp.tools.translate import _
from openerp.tools.safe_eval import safe_eval
@ -456,7 +456,7 @@ class document_directory_content(osv.osv):
if node.extension != '.pdf':
raise Exception("Invalid content: %s" % node.extension)
report = self.pool.get('ir.actions.report.xml').browse(cr, uid, node.report_id, context=context)
srv = netsvc.Service._services['report.'+report.report_name]
srv = openerp.report.interface.report_int._reports['report.'+report.report_name]
ctx = node.context.context.copy()
ctx.update(node.dctx)
pdf,pdftype = srv.create(cr, uid, [node.act_id,], {}, context=ctx)

View File

@ -53,7 +53,7 @@ def exp_import_edi_document(db_name, uid, passwd, edi_document, context=None):
def exp_import_edi_url(db_name, uid, passwd, edi_url, context=None):
return _edi_dispatch(db_name, 'import_edi', uid, None, edi_url)
@openerp.service.rpc('edi')
@openerp.http.rpc('edi')
def dispatch(method, params):
if method in ['import_edi_document', 'import_edi_url']:
(db, uid, passwd) = params[0:3]

View File

@ -30,21 +30,22 @@
##############################################################################
from openerp.osv import fields, osv
from openerp import netsvc
from webkit_report import WebKitParser
import openerp.report.interface
from openerp.report.report_sxw import rml_parse
from webkit_report import WebKitParser
def register_report(name, model, tmpl_path, parser=rml_parse):
"""Register the report into the services"""
name = 'report.%s' % name
if netsvc.Service._services.get(name, False):
service = netsvc.Service._services[name]
if name in openerp.report.interface.report_int._reports:
service = openerp.report.interface.report_int[name]
if isinstance(service, WebKitParser):
#already instantiated properly, skip it
return
if hasattr(service, 'parser'):
parser = service.parser
del netsvc.Service._services[name]
del openerp.report.interface.report_int[name]
WebKitParser(name, model, tmpl_path, parser=parser)