[FIX] P3: import pattern which doesn't seem to work right
``import odoo.addons.foo as bar`` doesn't seem to properly trigger the import hook in Python 3 (it blows up on decimal_precision and base). Thus convert *all* examples of that pattern to the more sensible ``from odoo.addons import foo as bar``.
This commit is contained in:
@@ -10,7 +10,7 @@ from odoo.tools import float_is_zero, float_compare, pycompat
|
||||
|
||||
from odoo.exceptions import UserError, RedirectWarning, ValidationError, Warning
|
||||
|
||||
import odoo.addons.decimal_precision as dp
|
||||
from odoo.addons import decimal_precision as dp
|
||||
import logging
|
||||
|
||||
_logger = logging.getLogger(__name__)
|
||||
|
||||
@@ -8,7 +8,7 @@ from odoo.exceptions import RedirectWarning, UserError, ValidationError
|
||||
from odoo.tools.misc import formatLang
|
||||
from odoo.tools import float_is_zero, float_compare
|
||||
from odoo.tools.safe_eval import safe_eval
|
||||
import odoo.addons.decimal_precision as dp
|
||||
from odoo.addons import decimal_precision as dp
|
||||
from lxml import etree
|
||||
|
||||
#----------------------------------------------------------
|
||||
|
||||
@@ -6,7 +6,7 @@ from dateutil.relativedelta import relativedelta
|
||||
from odoo import api, fields, models
|
||||
from odoo.tools import DEFAULT_SERVER_DATE_FORMAT as DF
|
||||
|
||||
import odoo.addons.decimal_precision as dp
|
||||
from odoo.addons import decimal_precision as dp
|
||||
|
||||
|
||||
class AccountInvoice(models.Model):
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
|
||||
from odoo import fields, models, api, _
|
||||
import odoo.addons.decimal_precision as dp
|
||||
from odoo.addons import decimal_precision as dp
|
||||
from odoo.exceptions import UserError
|
||||
from odoo.tools import pycompat
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from odoo import models, fields, api
|
||||
import odoo.addons.decimal_precision as dp
|
||||
from odoo.addons import decimal_precision as dp
|
||||
|
||||
|
||||
class PriceRule(models.Model):
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
from odoo import models, fields, api, _
|
||||
from odoo.exceptions import UserError
|
||||
import odoo.addons.decimal_precision as dp
|
||||
from odoo.addons import decimal_precision as dp
|
||||
|
||||
|
||||
class SaleOrder(models.Model):
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
from odoo import api, fields, models
|
||||
|
||||
import odoo.addons.decimal_precision as dp
|
||||
from odoo.addons import decimal_precision as dp
|
||||
|
||||
|
||||
class StockMove(models.Model):
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
from odoo import models, fields, api, _
|
||||
from odoo.exceptions import UserError
|
||||
|
||||
import odoo.addons.decimal_precision as dp
|
||||
from odoo.addons import decimal_precision as dp
|
||||
|
||||
|
||||
class StockQuantPackage(models.Model):
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
from odoo import api, fields, models, _
|
||||
from odoo.exceptions import ValidationError, UserError
|
||||
|
||||
import odoo.addons.decimal_precision as dp
|
||||
from odoo.addons import decimal_precision as dp
|
||||
|
||||
|
||||
class EventType(models.Model):
|
||||
|
||||
@@ -7,7 +7,7 @@ from odoo import api, fields, models, _
|
||||
from odoo.exceptions import UserError
|
||||
from odoo.tools import email_split, float_is_zero, pycompat
|
||||
|
||||
import odoo.addons.decimal_precision as dp
|
||||
from odoo.addons import decimal_precision as dp
|
||||
|
||||
|
||||
class HrExpense(models.Model):
|
||||
@@ -557,4 +557,4 @@ class HrExpenseSheet(models.Model):
|
||||
def _check_employee(self):
|
||||
employee_ids = self.expense_line_ids.mapped('employee_id')
|
||||
if len(employee_ids) > 1 or (len(employee_ids) == 1 and employee_ids != self.employee_id):
|
||||
raise ValidationError(_('You cannot add expense lines of another employee.'))
|
||||
raise ValidationError(_('You cannot add expense lines of another employee.'))
|
||||
|
||||
@@ -10,7 +10,7 @@ from threading import Thread, Lock
|
||||
|
||||
from odoo import http
|
||||
|
||||
import odoo.addons.hw_proxy.controllers.main as hw_proxy
|
||||
from odoo.addons.hw_proxy.controllers import main as hw_proxy
|
||||
|
||||
_logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ except ImportError:
|
||||
|
||||
from odoo import http, _
|
||||
|
||||
import odoo.addons.hw_proxy.controllers.main as hw_proxy
|
||||
from odoo.addons.hw_proxy.controllers import main as hw_proxy
|
||||
|
||||
_logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ import traceback
|
||||
from hashlib import md5
|
||||
|
||||
from PIL import Image
|
||||
import xml.etree.ElementTree as ET
|
||||
from xml.etree import ElementTree as ET
|
||||
|
||||
try:
|
||||
import jcconv
|
||||
|
||||
@@ -8,7 +8,7 @@ import threading
|
||||
|
||||
from odoo import http
|
||||
|
||||
import odoo.addons.hw_proxy.controllers.main as hw_proxy
|
||||
from odoo.addons.hw_proxy.controllers import main as hw_proxy
|
||||
|
||||
_logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ from threading import Thread, Lock
|
||||
|
||||
from odoo import http
|
||||
|
||||
import odoo.addons.hw_proxy.controllers.main as hw_proxy
|
||||
from odoo.addons.hw_proxy.controllers import main as hw_proxy
|
||||
|
||||
_logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ from threading import Thread, Lock
|
||||
|
||||
from odoo import http
|
||||
|
||||
import odoo.addons.hw_proxy.controllers.main as hw_proxy
|
||||
from odoo.addons.hw_proxy.controllers import main as hw_proxy
|
||||
|
||||
_logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
import base64
|
||||
import xml.etree.ElementTree as ET
|
||||
from xml.etree import ElementTree as ET
|
||||
from collections import namedtuple
|
||||
|
||||
from odoo import api, exceptions, fields, models, _
|
||||
|
||||
@@ -8,7 +8,7 @@ import datetime
|
||||
|
||||
from odoo import api, fields, models, _
|
||||
from odoo.exceptions import AccessError, ValidationError
|
||||
import odoo.addons.decimal_precision as dp
|
||||
from odoo.addons import decimal_precision as dp
|
||||
|
||||
from odoo.tools import pycompat
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ from odoo.exceptions import UserError, ValidationError
|
||||
from odoo.tools import pycompat
|
||||
from odoo.tools.safe_eval import safe_eval
|
||||
|
||||
import odoo.addons.decimal_precision as dp
|
||||
from odoo.addons import decimal_precision as dp
|
||||
|
||||
_intervalTypes = {
|
||||
'hours': lambda interval: relativedelta(hours=interval),
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from odoo import api, fields, models
|
||||
import odoo.addons.decimal_precision as dp
|
||||
from odoo.addons import decimal_precision as dp
|
||||
|
||||
STATE = [
|
||||
('none', 'Non Member'),
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from odoo import api, fields, models
|
||||
import odoo.addons.decimal_precision as dp
|
||||
from odoo.addons import decimal_precision as dp
|
||||
|
||||
|
||||
class MembershipInvoice(models.TransientModel):
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
import requests
|
||||
from lxml import etree, objectify
|
||||
from StringIO import StringIO
|
||||
import xml.etree.ElementTree as ET
|
||||
from xml.etree import ElementTree as ET
|
||||
from uuid import uuid4
|
||||
|
||||
from odoo.exceptions import ValidationError, UserError
|
||||
|
||||
@@ -10,7 +10,7 @@ from odoo import api, fields, models, tools, _
|
||||
from odoo.tools import float_is_zero, pycompat
|
||||
from odoo.exceptions import UserError
|
||||
from odoo.http import request
|
||||
import odoo.addons.decimal_precision as dp
|
||||
from odoo.addons import decimal_precision as dp
|
||||
|
||||
_logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ from psycopg2 import OperationalError
|
||||
from odoo import api, fields, models, registry, _
|
||||
from odoo.exceptions import UserError
|
||||
|
||||
import odoo.addons.decimal_precision as dp
|
||||
from odoo.addons import decimal_precision as dp
|
||||
|
||||
PROCUREMENT_PRIORITIES = [('0', 'Not urgent'), ('1', 'Normal'), ('2', 'Urgent'), ('3', 'Very Urgent')]
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ from odoo import api, fields, models, tools, _
|
||||
from odoo.exceptions import ValidationError
|
||||
from odoo.osv import expression
|
||||
|
||||
import odoo.addons.decimal_precision as dp
|
||||
from odoo.addons import decimal_precision as dp
|
||||
|
||||
from odoo.tools import pycompat
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ from itertools import chain
|
||||
from odoo import api, fields, models, tools, _
|
||||
from odoo.exceptions import UserError, ValidationError
|
||||
|
||||
import odoo.addons.decimal_precision as dp
|
||||
from odoo.addons import decimal_precision as dp
|
||||
|
||||
from odoo.tools import pycompat
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
import itertools
|
||||
import psycopg2
|
||||
|
||||
import odoo.addons.decimal_precision as dp
|
||||
from odoo.addons import decimal_precision as dp
|
||||
|
||||
from odoo import api, fields, models, tools, _
|
||||
from odoo.exceptions import ValidationError, except_orm
|
||||
|
||||
@@ -10,7 +10,7 @@ from odoo.tools.float_utils import float_is_zero, float_compare
|
||||
from odoo.exceptions import UserError, AccessError
|
||||
from odoo.tools.misc import formatLang
|
||||
from odoo.addons.base.res.res_partner import WARNING_MESSAGE, WARNING_HELP
|
||||
import odoo.addons.decimal_precision as dp
|
||||
from odoo.addons import decimal_precision as dp
|
||||
|
||||
|
||||
class PurchaseOrder(models.Model):
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from odoo import api, fields, models, _
|
||||
import odoo.addons.decimal_precision as dp
|
||||
from odoo.addons import decimal_precision as dp
|
||||
from odoo.exceptions import UserError
|
||||
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ from odoo.exceptions import UserError
|
||||
from odoo.tools import float_is_zero, float_compare, DEFAULT_SERVER_DATETIME_FORMAT, pycompat
|
||||
from odoo.tools.misc import formatLang
|
||||
|
||||
import odoo.addons.decimal_precision as dp
|
||||
from odoo.addons import decimal_precision as dp
|
||||
|
||||
|
||||
class SaleOrder(models.Model):
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
import time
|
||||
|
||||
from odoo import api, fields, models, _
|
||||
import odoo.addons.decimal_precision as dp
|
||||
from odoo.addons import decimal_precision as dp
|
||||
from odoo.exceptions import UserError
|
||||
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from odoo import api, fields, models
|
||||
import odoo.addons.decimal_precision as dp
|
||||
from odoo.addons import decimal_precision as dp
|
||||
|
||||
|
||||
class SaleOrderLine(models.Model):
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
import datetime
|
||||
from itertools import islice
|
||||
import json
|
||||
import xml.etree.ElementTree as ET
|
||||
from xml.etree import ElementTree as ET
|
||||
import logging
|
||||
import re
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ from datetime import datetime, timedelta
|
||||
|
||||
from odoo import api, fields, models, _
|
||||
from odoo.tools.translate import html_translate
|
||||
import odoo.addons.decimal_precision as dp
|
||||
from odoo.addons import decimal_precision as dp
|
||||
|
||||
|
||||
class SaleOrderLine(models.Model):
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
from odoo import api, fields, models
|
||||
from odoo.tools.translate import html_translate
|
||||
import odoo.addons.decimal_precision as dp
|
||||
from odoo.addons import decimal_precision as dp
|
||||
|
||||
|
||||
class SaleQuoteTemplate(models.Model):
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
from odoo import api, fields, models, tools, _
|
||||
import odoo.addons.decimal_precision as dp
|
||||
from odoo.addons import decimal_precision as dp
|
||||
|
||||
from odoo.tools import pycompat
|
||||
from odoo.tools.translate import html_translate
|
||||
|
||||
@@ -6,7 +6,7 @@ import psycopg2
|
||||
from odoo.models import BaseModel
|
||||
from odoo.tests.common import TransactionCase
|
||||
from odoo.tools import mute_logger, pycompat
|
||||
import odoo.osv.expression as expression
|
||||
from odoo.osv import expression
|
||||
|
||||
|
||||
class TestExpression(TransactionCase):
|
||||
|
||||
@@ -6,7 +6,7 @@ from psycopg2 import IntegrityError
|
||||
import odoo
|
||||
from odoo.exceptions import UserError, ValidationError
|
||||
from odoo.tools import mute_logger
|
||||
import odoo.tests.common as common
|
||||
from odoo.tests import common
|
||||
|
||||
|
||||
class TestServerActionsBase(common.TransactionCase):
|
||||
|
||||
+1
-1
@@ -7,7 +7,7 @@ import shutil
|
||||
import tempfile
|
||||
import threading
|
||||
import traceback
|
||||
import xml.etree.ElementTree as ET
|
||||
from xml.etree import ElementTree as ET
|
||||
import zipfile
|
||||
|
||||
from functools import wraps
|
||||
|
||||
@@ -39,7 +39,7 @@ import odoo
|
||||
from odoo.modules.module import run_unit_tests, runs_post_install
|
||||
from odoo.modules.registry import Registry
|
||||
from odoo.release import nt_service_name
|
||||
import odoo.tools.config as config
|
||||
from odoo.tools import config
|
||||
from odoo.tools import stripped_sys_argv, dumpstacks, log_ormcache_stats, pycompat
|
||||
|
||||
_logger = logging.getLogger(__name__)
|
||||
@@ -212,6 +212,7 @@ class ThreadedServer(CommonServer):
|
||||
self.quit_signals_received += 1
|
||||
|
||||
def cron_thread(self, number):
|
||||
from odoo.addons.base.ir.ir_cron import ir_cron
|
||||
while True:
|
||||
time.sleep(SLEEP_INTERVAL + number) # Steve Reich timing style
|
||||
registries = odoo.modules.registry.Registry.registries
|
||||
@@ -219,7 +220,7 @@ class ThreadedServer(CommonServer):
|
||||
for db_name, registry in pycompat.items(registries):
|
||||
while registry.ready:
|
||||
try:
|
||||
acquired = odoo.addons.base.ir.ir_cron.ir_cron._acquire_job(db_name)
|
||||
acquired = ir_cron._acquire_job(db_name)
|
||||
if not acquired:
|
||||
break
|
||||
except Exception:
|
||||
@@ -814,7 +815,7 @@ class WorkerCron(Worker):
|
||||
start_time = time.time()
|
||||
start_rss, start_vms = memory_info(psutil.Process(os.getpid()))
|
||||
|
||||
import odoo.addons.base as base
|
||||
from odoo.addons import base
|
||||
base.ir.ir_cron.ir_cron._acquire_job(db_name)
|
||||
odoo.modules.registry.Registry.delete(db_name)
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ import werkzeug.serving
|
||||
import werkzeug.contrib.fixers
|
||||
|
||||
import odoo
|
||||
import odoo.tools.config as config
|
||||
from odoo.tools import config
|
||||
|
||||
_logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
import logging
|
||||
import lxml.html.clean as clean
|
||||
from lxml.html import clean
|
||||
import random
|
||||
import re
|
||||
import socket
|
||||
|
||||
Reference in New Issue
Block a user