[FIX] base: adapt imports
This commit is contained in:
@@ -3,14 +3,14 @@
|
||||
|
||||
""" Addons module.
|
||||
|
||||
This module serves to contain all OpenERP addons, across all configured addons
|
||||
paths. For the code to manage those addons, see openerp.modules.
|
||||
This module serves to contain all Odoo addons, across all configured addons
|
||||
paths. For the code to manage those addons, see odoo.modules.
|
||||
|
||||
Addons are made available under `openerp.addons` after
|
||||
openerp.tools.config.parse_config() is called (so that the addons paths are
|
||||
Addons are made available under `odoo.addons` after
|
||||
odoo.tools.config.parse_config() is called (so that the addons paths are
|
||||
known).
|
||||
|
||||
This module also conveniently reexports some symbols from openerp.modules.
|
||||
This module also conveniently reexports some symbols from odoo.modules.
|
||||
Importing them from here is deprecated.
|
||||
|
||||
"""
|
||||
|
||||
@@ -10,8 +10,8 @@ import tests
|
||||
|
||||
def post_init(cr, registry):
|
||||
"""Rewrite ICP's to force groups"""
|
||||
from openerp import api, SUPERUSER_ID
|
||||
from openerp.addons.base.ir.ir_config_parameter import _default_parameters
|
||||
from odoo import api, SUPERUSER_ID
|
||||
from odoo.addons.base.ir.ir_config_parameter import _default_parameters
|
||||
|
||||
env = api.Environment(cr, SUPERUSER_ID, {})
|
||||
ICP = env['ir.config_parameter']
|
||||
|
||||
@@ -51,11 +51,11 @@ class IrFieldsConverter(models.AbstractModel):
|
||||
@api.model
|
||||
def for_model(self, model, fromtype=str):
|
||||
""" Returns a converter object for the model. A converter is a
|
||||
callable taking a record-ish (a dictionary representing an openerp
|
||||
callable taking a record-ish (a dictionary representing an odoo
|
||||
record with values of typetag ``fromtype``) and returning a converted
|
||||
records matching what :meth:`openerp.osv.orm.Model.write` expects.
|
||||
records matching what :meth:`odoo.osv.orm.Model.write` expects.
|
||||
|
||||
:param model: :class:`openerp.osv.orm.Model` for the conversion base
|
||||
:param model: :class:`odoo.osv.orm.Model` for the conversion base
|
||||
:returns: a converter callable
|
||||
:rtype: (record: dict, logger: (field, error) -> None) -> dict
|
||||
"""
|
||||
@@ -122,10 +122,10 @@ class IrFieldsConverter(models.AbstractModel):
|
||||
as ``ValueError`` above.
|
||||
|
||||
:param field: field object to generate a value for
|
||||
:type field: :class:`openerp.fields.Field`
|
||||
:type field: :class:`odoo.fields.Field`
|
||||
:param fromtype: type to convert to something fitting for ``field``
|
||||
:type fromtype: type | str
|
||||
:param context: openerp request context
|
||||
:param context: odoo request context
|
||||
:return: a function (fromtype -> field.write_type), if a converter is found
|
||||
:rtype: Callable | None
|
||||
"""
|
||||
|
||||
@@ -79,7 +79,7 @@ class IrFilters(models.Model):
|
||||
This method should only be called if ``vals`` is trying to set
|
||||
``is_default``
|
||||
|
||||
:raises openerp.exceptions.UserError: if there is an existing default and
|
||||
:raises odoo.exceptions.UserError: if there is an existing default and
|
||||
we're not updating it
|
||||
"""
|
||||
domain = self._get_action_domain(vals.get('action_id'))
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from openerp.tools import safe_eval, html_escape as escape
|
||||
from odoo.tools import safe_eval, html_escape as escape
|
||||
|
||||
from . import fields
|
||||
from . import assetsbundle
|
||||
|
||||
@@ -9,11 +9,11 @@ import uuid
|
||||
from datetime import datetime
|
||||
from subprocess import Popen, PIPE
|
||||
from odoo import fields, tools
|
||||
from openerp.http import request
|
||||
from odoo.http import request
|
||||
from odoo.modules.module import get_resource_path
|
||||
import psycopg2
|
||||
import werkzeug
|
||||
from openerp.tools import func, misc
|
||||
from odoo.tools import func, misc
|
||||
|
||||
import logging
|
||||
_logger = logging.getLogger(__name__)
|
||||
|
||||
@@ -5,7 +5,7 @@ from odoo import api, fields, models, _
|
||||
from PIL import Image
|
||||
from cStringIO import StringIO
|
||||
import babel
|
||||
from openerp.tools import html_escape as escape, posix_to_ldml, safe_eval, float_utils
|
||||
from odoo.tools import html_escape as escape, posix_to_ldml, safe_eval, float_utils
|
||||
from .qweb import unicodifier
|
||||
|
||||
import logging
|
||||
|
||||
@@ -8,9 +8,9 @@ from .assetsbundle import AssetsBundle
|
||||
from lxml import etree
|
||||
from collections import OrderedDict
|
||||
|
||||
from openerp import api, models, tools
|
||||
import openerp.tools.safe_eval as safe_eval
|
||||
from openerp.http import request
|
||||
from odoo import api, models, tools
|
||||
from odoo.tools.safe_eval import assert_valid_codeobj, _BUILTINS, _SAFE_OPCODES
|
||||
from odoo.http import request
|
||||
from odoo.modules.module import get_resource_path
|
||||
import json
|
||||
from time import time
|
||||
@@ -290,14 +290,14 @@ class IrQWeb(models.AbstractModel, QWeb):
|
||||
# string must be stripped otherwise whitespace before the start for
|
||||
# formatting purpose are going to break parse/compile
|
||||
st = ast.parse(expr.strip(), mode='eval')
|
||||
safe_eval.assert_valid_codeobj(
|
||||
safe_eval._SAFE_OPCODES,
|
||||
assert_valid_codeobj(
|
||||
_SAFE_OPCODES,
|
||||
compile(st, '<>', 'eval'), # could be expr, but eval *should* be fine
|
||||
expr
|
||||
)
|
||||
|
||||
# ast.Expression().body -> expr
|
||||
return Contextifier(safe_eval._BUILTINS).visit(st).body
|
||||
return Contextifier(_BUILTINS).visit(st).body
|
||||
|
||||
def _get_attr_bool(self, attr, default=False):
|
||||
if attr:
|
||||
|
||||
@@ -495,7 +495,7 @@ class QWeb(object):
|
||||
from collections import OrderedDict
|
||||
import itertools
|
||||
from itertools import repeat, imap
|
||||
from openerp.addons.base.ir.ir_qweb.qweb import escape, unicodifier, foreach_iterator
|
||||
from odoo.addons.base.ir.ir_qweb.qweb import escape, unicodifier, foreach_iterator
|
||||
"""))
|
||||
|
||||
def _create_def(self, options, body, prefix='fn', lineno=None):
|
||||
|
||||
@@ -684,16 +684,16 @@ class Module(models.Model):
|
||||
# extract path is not the same
|
||||
base_path = os.path.dirname(modules.get_module_path('base'))
|
||||
|
||||
# copy all modules in the SERVER/openerp/addons directory to the new "openerp" module (except base itself)
|
||||
# copy all modules in the SERVER/odoo/addons directory to the new "odoo" module (except base itself)
|
||||
for d in os.listdir(base_path):
|
||||
if d != 'base' and os.path.isdir(os.path.join(base_path, d)):
|
||||
destdir = os.path.join(tmp, OPENERP, 'addons', d) # XXX 'openerp' subdirectory ?
|
||||
destdir = os.path.join(tmp, OPENERP, 'addons', d) # XXX 'odoo' subdirectory ?
|
||||
shutil.copytree(os.path.join(base_path, d), destdir)
|
||||
|
||||
# then replace the server by the new "base" module
|
||||
server_dir = tools.config['root_path'] # XXX or dirname()
|
||||
bck = backup(server_dir)
|
||||
_logger.info('Copy downloaded module `openerp` to `%s`', server_dir)
|
||||
_logger.info('Copy downloaded module `odoo` to `%s`', server_dir)
|
||||
shutil.move(os.path.join(tmp, OPENERP), server_dir)
|
||||
#if bck:
|
||||
# shutil.rmtree(bck)
|
||||
@@ -723,7 +723,7 @@ class Module(models.Model):
|
||||
|
||||
@api.model
|
||||
def get_apps_server(self):
|
||||
return tools.config.get('apps_server', 'https://apps.openerp.com/apps')
|
||||
return tools.config.get('apps_server', 'https://apps.odoo.com/apps')
|
||||
|
||||
def _update_dependencies(self, depends=None):
|
||||
existing = set(dep.name for dep in self.dependencies_id)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from openerp.report import report_sxw
|
||||
from odoo.report import report_sxw
|
||||
|
||||
class rmlparser(report_sxw.rml_parse):
|
||||
def set_context(self, objects, data, ids, report_type = None):
|
||||
|
||||
@@ -169,7 +169,7 @@ class Currency(models.Model):
|
||||
function = ""
|
||||
for currency in self.search([]):
|
||||
symbol = currency.symbol or currency.name
|
||||
format_number_str = "openerp.web.format_value(arguments[0], {type: 'float', digits: [69,%s]}, 0.00)" % currency.decimal_places
|
||||
format_number_str = "odoo.web.format_value(arguments[0], {type: 'float', digits: [69,%s]}, 0.00)" % currency.decimal_places
|
||||
if currency.position == 'after':
|
||||
return_str = "return %s + '\\xA0' + %s;" % (format_number_str, json.dumps(symbol))
|
||||
else:
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from openerp.tests import common
|
||||
import openerp
|
||||
from odoo.tests import common
|
||||
import odoo
|
||||
|
||||
GIF = "R0lGODdhAQABAIAAAP///////ywAAAAAAQABAAACAkQBADs="
|
||||
|
||||
@@ -67,7 +67,7 @@ class test_ir_http_mimetype(common.TransactionCase):
|
||||
'type': 'binary',
|
||||
})
|
||||
|
||||
resized = openerp.tools.image_get_resized_images(prop.value_binary, return_big=True, avoid_resize_medium=True)['image_small']
|
||||
resized = odoo.tools.image_get_resized_images(prop.value_binary, return_big=True, avoid_resize_medium=True)['image_small']
|
||||
# Simul computed field which resize and that is not attachement=True (E.G. on product)
|
||||
prop.write({'value_binary': resized})
|
||||
status, headers, content = self.env['ir.http'].binary_content(
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import base64
|
||||
import unittest
|
||||
|
||||
from openerp.tools.mimetypes import guess_mimetype
|
||||
from odoo.tools.mimetypes import guess_mimetype
|
||||
|
||||
PNG = 'iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAIAAACQd1PeAAAADElEQVQI12P4//8/AAX+Av7czFnnAAAAAElFTkSuQmCC'
|
||||
GIF = "R0lGODdhAQABAIAAAP///////ywAAAAAAQABAAACAkQBADs="
|
||||
|
||||
@@ -6,9 +6,9 @@
|
||||
from contextlib import contextmanager
|
||||
import unittest
|
||||
|
||||
from openerp import api, registry, SUPERUSER_ID
|
||||
from openerp.tests import common
|
||||
from openerp.modules.registry import Registry
|
||||
from odoo import api, registry, SUPERUSER_ID
|
||||
from odoo.tests import common
|
||||
from odoo.modules.registry import Registry
|
||||
|
||||
|
||||
@contextmanager
|
||||
@@ -28,7 +28,7 @@ MODEL = 'test_uninstall.model'
|
||||
class TestUninstall(unittest.TestCase):
|
||||
"""
|
||||
Test the install/uninstall of a test module. The module is available in
|
||||
`openerp.tests` which should be present in the addons-path.
|
||||
`odoo.tests` which should be present in the addons-path.
|
||||
"""
|
||||
|
||||
def test_01_install(self):
|
||||
|
||||
@@ -4,7 +4,7 @@ import logging
|
||||
from operator import itemgetter
|
||||
import os
|
||||
|
||||
from openerp import report, tools
|
||||
from odoo import report, tools
|
||||
|
||||
_logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
import time
|
||||
|
||||
from openerp import models, api
|
||||
from odoo import models, api
|
||||
|
||||
class m(models.Model):
|
||||
""" This model exposes a few methods that will consume between 'almost no
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
import os.path
|
||||
import unittest
|
||||
|
||||
from openerp.tools.mimetypes import guess_mimetype
|
||||
from odoo.tools.mimetypes import guess_mimetype
|
||||
|
||||
def contents(extension):
|
||||
with open(os.path.join(
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
|
||||
import datetime
|
||||
|
||||
from openerp import models, fields, api, _
|
||||
from openerp.exceptions import AccessError
|
||||
from odoo import models, fields, api, _
|
||||
from odoo.exceptions import AccessError
|
||||
|
||||
|
||||
class Category(models.Model):
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<odoo>
|
||||
<template id="assets_backend" name="test_new_api backend assets" inherit_id="web.assets_backend">
|
||||
<xpath expr="//script[last()]" position="after">
|
||||
<script type="text/javascript" src="/test_new_api/static/test/x2many.js"></script>
|
||||
</xpath>
|
||||
</template>
|
||||
</openerp>
|
||||
</odoo>
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from openerp.tests import common
|
||||
from odoo.tests import common
|
||||
|
||||
ANSWER_TO_ULTIMATE_QUESTION = 42
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from openerp.tests import common
|
||||
from odoo.tests import common
|
||||
|
||||
|
||||
class test_domain(common.TransactionCase):
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
#
|
||||
from datetime import date, datetime
|
||||
|
||||
from openerp.exceptions import AccessError, except_orm
|
||||
from openerp.tests import common
|
||||
from openerp.tools import mute_logger
|
||||
from odoo.exceptions import AccessError, except_orm
|
||||
from odoo.tests import common
|
||||
from odoo.tools import mute_logger
|
||||
|
||||
|
||||
class TestFields(common.TransactionCase):
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from openerp.tests import common
|
||||
from odoo.tests import common
|
||||
|
||||
def strip_prefix(prefix, names):
|
||||
size = len(prefix)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from openerp import fields, models
|
||||
from odoo import fields, models
|
||||
|
||||
|
||||
class GroupOnDate(models.Model):
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from openerp.tests import common
|
||||
from odoo.tests import common
|
||||
|
||||
|
||||
class TestEmptyDate(common.TransactionCase):
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from openerp.tests import common
|
||||
from odoo.tests import common
|
||||
|
||||
|
||||
class TestGroupBooleans(common.TransactionCase):
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from openerp import models, fields
|
||||
from odoo import models, fields
|
||||
|
||||
class test_uninstall_model(models.Model):
|
||||
"""
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
Load the french translation.
|
||||
-
|
||||
!python {model: ir.translation }: |
|
||||
import openerp
|
||||
openerp.tools.trans_load(cr, 'test_translation_import/i18n/fr.po', 'fr_FR', verbose=False)
|
||||
import odoo
|
||||
odoo.tools.trans_load(cr, 'test_translation_import/i18n/fr.po', 'fr_FR', verbose=False)
|
||||
-
|
||||
Assert we have loaded the correct number of entries for the given source string.
|
||||
-
|
||||
|
||||
Reference in New Issue
Block a user