summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVo Minh Thu <vmt@openerp.com>2013-02-01 12:22:32 +0100
committerVo Minh Thu <vmt@openerp.com>2013-02-01 12:22:32 +0100
commitc8ffd1cedce3b80317687f3929697222c9d79e4e (patch)
treefeed717ea3e09a6a3bd3897881d0e33c52af8e6a
parentf0e4a9b01ea44768d9ebeb9c4110a617adcc31f9 (diff)
[REF] service: netsvc.Service is removed. LocalService(object_proxy) is never used so it is removed.
bzr revid: vmt@openerp.com-20130201112232-2k8geufmryx6p249
-rw-r--r--openerp/addons/base/ir/ir_actions.py5
-rw-r--r--openerp/netsvc.py24
-rw-r--r--openerp/report/interface.py12
3 files changed, 12 insertions, 29 deletions
diff --git a/openerp/addons/base/ir/ir_actions.py b/openerp/addons/base/ir/ir_actions.py
index 4404b0a8a50..beb4e27200a 100644
--- a/openerp/addons/base/ir/ir_actions.py
+++ b/openerp/addons/base/ir/ir_actions.py
@@ -28,6 +28,7 @@ import time
from openerp import SUPERUSER_ID
from openerp import netsvc, tools
from openerp.osv import fields, osv
+import openerp.report.interface
from openerp.report.report_sxw import report_sxw, report_rml
from openerp.tools.config import config
from openerp.tools.safe_eval import safe_eval as eval
@@ -93,9 +94,9 @@ class report_xml(osv.osv):
opj = os.path.join
cr.execute("SELECT * FROM ir_act_report_xml WHERE auto=%s ORDER BY id", (True,))
result = cr.dictfetchall()
- svcs = netsvc.Service._services
+ reports = openerp.report.interface.report_int._reports
for r in result:
- if svcs.has_key('report.'+r['report_name']):
+ if reports.has_key('report.'+r['report_name']):
continue
if r['report_rml'] or r['report_rml_content_data']:
report_sxw('report.'+r['report_name'], r['model'],
diff --git a/openerp/netsvc.py b/openerp/netsvc.py
index 6b70dc972a8..5aee8e53cc1 100644
--- a/openerp/netsvc.py
+++ b/openerp/netsvc.py
@@ -47,35 +47,13 @@ import openerp
_logger = logging.getLogger(__name__)
-
-class Service(object):
- """ Base class for Local services
- Functionality here is trusted, no authentication.
- Workflow engine and reports subclass this.
- """
- _services = {}
- def __init__(self, name):
- Service._services[name] = self
- self.__name = name
-
- @classmethod
- def exists(cls, name):
- return name in cls._services
-
- @classmethod
- def remove(cls, name):
- if cls.exists(name):
- cls._services.pop(name)
-
def LocalService(name):
# Special case for addons support, will be removed in a few days when addons
# are updated to directly use openerp.osv.osv.service.
- if name == 'object_proxy':
- return openerp.service.model
if name == 'workflow':
return openerp.workflow
- return Service._services[name]
+ return openerp.report.interface.report_int._reports[name]
BLACK, RED, GREEN, YELLOW, BLUE, MAGENTA, CYAN, WHITE, _NOTHING, DEFAULT = range(10)
#The background is set with 40 plus the number of the color, and the foreground with 30
diff --git a/openerp/report/interface.py b/openerp/report/interface.py
index 88331db1f4d..f0de9631800 100644
--- a/openerp/report/interface.py
+++ b/openerp/report/interface.py
@@ -23,7 +23,6 @@ import os
import re
from lxml import etree
-import openerp.netsvc as netsvc
import openerp.pooler as pooler
import openerp.tools as tools
@@ -40,12 +39,17 @@ def toxml(value):
unicode_value = tools.ustr(value)
return unicode_value.replace('&', '&amp;').replace('<','&lt;').replace('>','&gt;')
-class report_int(netsvc.Service):
+class report_int(object):
+
+ _reports = {}
+
def __init__(self, name):
- assert not self.exists(name), 'The report "%s" already exists!' % name
- super(report_int, self).__init__(name)
if not name.startswith('report.'):
raise Exception('ConceptionError, bad report name, should start with "report."')
+ assert name not in self._reports, 'The report "%s" already exists!' % name
+ self._reports[name] = self
+ self.__name = name
+
self.name = name
self.id = 0
self.name2 = '.'.join(name.split('.')[1:])