[FIX] ImportError;
parent
b16c6f36e3
commit
3b172ff276
|
@ -7,8 +7,10 @@ import logging
|
|||
import os
|
||||
|
||||
from odoo import fields, models
|
||||
from odoo.exceptions import UserError
|
||||
from odoo.modules import get_module_path
|
||||
from odoo.tools import config
|
||||
from odoo.tools.translate import _
|
||||
|
||||
from .. import compare
|
||||
|
||||
|
@ -35,7 +37,11 @@ class UpgradeAnalysis(models.Model):
|
|||
log = fields.Text(readonly=True)
|
||||
upgrade_path = fields.Char(
|
||||
default=config.get("upgrade_path", False),
|
||||
help="The base file path to save the analyse files of Odoo modules",
|
||||
help=(
|
||||
"The base file path to save the analyse files of Odoo modules. "
|
||||
"Default is taken from Odoo's --upgrade-path command line option. "
|
||||
),
|
||||
required=True,
|
||||
)
|
||||
|
||||
write_files = fields.Boolean(
|
||||
|
@ -56,11 +62,6 @@ class UpgradeAnalysis(models.Model):
|
|||
):
|
||||
module = self.env["ir.module.module"].search([("name", "=", module_name)])[0]
|
||||
if module.is_odoo_module:
|
||||
if not self.upgrade_path:
|
||||
return (
|
||||
"ERROR: no upgrade_path set when writing analysis of %s\n"
|
||||
% module_name
|
||||
)
|
||||
module_path = os.path.join(self.upgrade_path, module_name)
|
||||
full_path = os.path.join(module_path, version)
|
||||
else:
|
||||
|
@ -98,6 +99,11 @@ class UpgradeAnalysis(models.Model):
|
|||
}
|
||||
)
|
||||
|
||||
if not self.upgrade_path:
|
||||
return (
|
||||
"ERROR: no upgrade_path set when writing analysis of %s\n" % module_name
|
||||
)
|
||||
|
||||
connection = self.config_id.get_connection()
|
||||
RemoteRecord = self._get_remote_model(connection, "record")
|
||||
LocalRecord = self.env["upgrade.record"]
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
# Copyright 2016 Opener B.V. <https://opener.am>
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
from urllib.error import URLError
|
||||
|
||||
import odoorpc
|
||||
|
||||
from odoo import api, fields, models
|
||||
|
@ -39,7 +41,13 @@ class UpgradeComparisonConfig(models.Model):
|
|||
|
||||
def get_connection(self):
|
||||
self.ensure_one()
|
||||
remote = odoorpc.ODOO(self.server, port=self.port)
|
||||
try:
|
||||
remote = odoorpc.ODOO(self.server, port=self.port)
|
||||
except URLError:
|
||||
raise UserError(
|
||||
_("Could not connect the Odoo server at %s:%s")
|
||||
% (self.server, self.port)
|
||||
)
|
||||
remote.login(self.database, self.username, self.password)
|
||||
self.version = remote.version
|
||||
return remote
|
||||
|
|
|
@ -1,3 +1,2 @@
|
|||
from . import mrp
|
||||
from . import point_of_sale
|
||||
from . import stock
|
||||
|
|
Loading…
Reference in New Issue