Migrate addons to 10.0

This commit is contained in:
Guewen Baconnier
2016-12-21 21:29:09 +01:00
parent 022f9003e8
commit 8e4b461c75
17 changed files with 35 additions and 37 deletions
+1 -1
View File
@@ -27,7 +27,7 @@ env:
- TESTS="1" ODOO_REPO="odoo/odoo" - TESTS="1" ODOO_REPO="odoo/odoo"
- TESTS="1" ODOO_REPO="OCA/OCB" - TESTS="1" ODOO_REPO="OCA/OCB"
global: global:
- VERSION="9.0" LINT_CHECK="0" TESTS="0" - VERSION="10.0" LINT_CHECK="0" TESTS="0"
install: install:
- git clone --depth=1 https://github.com/OCA/maintainer-quality-tools.git ${HOME}/maintainer-quality-tools - git clone --depth=1 https://github.com/OCA/maintainer-quality-tools.git ${HOME}/maintainer-quality-tools
@@ -5,7 +5,7 @@
{'name': 'Attachments on S3 storage', {'name': 'Attachments on S3 storage',
'summary': 'Store assets and attachments on a S3 compatible object storage', 'summary': 'Store assets and attachments on a S3 compatible object storage',
'version': '9.0.1.1.0', 'version': '10.0.1.0.0',
'author': 'Camptocamp,Odoo Community Association (OCA)', 'author': 'Camptocamp,Odoo Community Association (OCA)',
'license': 'AGPL-3', 'license': 'AGPL-3',
'category': 'Knowledge Management', 'category': 'Knowledge Management',
+7 -8
View File
@@ -12,8 +12,8 @@ from functools import partial
import psycopg2 import psycopg2
import openerp import odoo
from openerp import _, api, exceptions, models, SUPERUSER_ID from odoo import _, api, exceptions, models
from ..s3uri import S3Uri from ..s3uri import S3Uri
_logger = logging.getLogger(__name__) _logger = logging.getLogger(__name__)
@@ -264,7 +264,7 @@ class IrAttachment(models.Model):
""" """
with api.Environment.manage(): with api.Environment.manage():
if new_cr: if new_cr:
registry = openerp.modules.registry.RegistryManager.get( registry = odoo.modules.registry.RegistryManager.get(
self.env.cr.dbname self.env.cr.dbname
) )
with closing(registry.cursor()) as cr: with closing(registry.cursor()) as cr:
@@ -289,12 +289,11 @@ class IrAttachment(models.Model):
else: else:
return super(IrAttachment, self).force_storage() return super(IrAttachment, self).force_storage()
@api.cr @api.model_cr
def _register_hook(self, cr): def _register_hook(self):
# We need to call the migration on the loading of the model # We need to call the migration on the loading of the model
# because when we are upgrading addons, some of them might # because when we are upgrading addons, some of them might
# add attachments, and to be sure the are migrated to S3, # add attachments, and to be sure the are migrated to S3,
# we need to call the migration here. # we need to call the migration here.
super(IrAttachment, self)._register_hook(cr) super(IrAttachment, self)._register_hook()
env = api.Environment(cr, SUPERUSER_ID, {}) self.sudo()._force_storage_s3()
env['ir.attachment']._force_storage_s3()
@@ -5,7 +5,7 @@
{'name': 'Cloud Platform', {'name': 'Cloud Platform',
'summary': 'Addons required for the Camptocamp Cloud Platform', 'summary': 'Addons required for the Camptocamp Cloud Platform',
'version': '9.0.1.0.0', 'version': '10.0.1.0.0',
'author': 'Camptocamp,Odoo Community Association (OCA)', 'author': 'Camptocamp,Odoo Community Association (OCA)',
'license': 'AGPL-3', 'license': 'AGPL-3',
'category': 'Extra Tools', 'category': 'Extra Tools',
+6 -7
View File
@@ -10,8 +10,8 @@ from collections import namedtuple
from distutils.util import strtobool from distutils.util import strtobool
from openerp import api, models, SUPERUSER_ID from odoo import api, models
from openerp.tools.config import config from odoo.tools.config import config
_logger = logging.getLogger(__name__) _logger = logging.getLogger(__name__)
@@ -124,8 +124,7 @@ class CloudPlatform(models.AbstractModel):
self._check_redis(environment_name) self._check_redis(environment_name)
self._check_metrics(environment_name) self._check_metrics(environment_name)
@api.cr @api.model_cr
def _register_hook(self, cr): def _register_hook(self):
super(CloudPlatform, self)._register_hook(cr) super(CloudPlatform, self)._register_hook()
env = api.Environment(cr, SUPERUSER_ID, {}) self.sudo().check()
env['cloud.platform'].check()
@@ -3,7 +3,7 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html) # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html)
{'name': 'JSON Logging', {'name': 'JSON Logging',
'version': '9.0.1.0.0', 'version': '10.0.1.0.0',
'author': 'Camptocamp,Odoo Community Association (OCA)', 'author': 'Camptocamp,Odoo Community Association (OCA)',
'license': 'AGPL-3', 'license': 'AGPL-3',
'category': 'Extra Tools', 'category': 'Extra Tools',
@@ -4,7 +4,7 @@
{'name': 'Monitoring: Requests Logging', {'name': 'Monitoring: Requests Logging',
'version': '9.0.1.0.0', 'version': '10.0.1.0.0',
'author': 'Camptocamp,Odoo Community Association (OCA)', 'author': 'Camptocamp,Odoo Community Association (OCA)',
'license': 'AGPL-3', 'license': 'AGPL-3',
'category': 'category', 'category': 'category',
+3 -3
View File
@@ -6,9 +6,9 @@ import json
import logging import logging
import time import time
from openerp import models from odoo import models
from openerp.http import request as http_request from odoo.http import request as http_request
from openerp.tools.config import config from odoo.tools.config import config
_logger = logging.getLogger('monitoring.http.requests') _logger = logging.getLogger('monitoring.http.requests')
@@ -4,7 +4,7 @@
{'name': 'Monitoring: Statsd Metrics', {'name': 'Monitoring: Statsd Metrics',
'version': '9.0.1.0.0', 'version': '10.0.1.0.0',
'author': 'Camptocamp', 'author': 'Camptocamp',
'license': 'AGPL-3', 'license': 'AGPL-3',
'category': 'category', 'category': 'category',
+2 -2
View File
@@ -2,8 +2,8 @@
# Copyright 2016 Camptocamp SA # Copyright 2016 Camptocamp SA
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html) # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html)
from openerp import models from odoo import models
from openerp.http import request from odoo.http import request
from ..statsd_client import statsd, customer, environment from ..statsd_client import statsd, customer, environment
+1 -1
View File
@@ -7,7 +7,7 @@ import os
from distutils.util import strtobool from distutils.util import strtobool
from openerp.tools.config import config from odoo.tools.config import config
_logger = logging.getLogger(__name__) _logger = logging.getLogger(__name__)
@@ -4,7 +4,7 @@
{'name': 'Monitoring: Status', {'name': 'Monitoring: Status',
'version': '9.0.1.0.0', 'version': '10.0.1.0.0',
'author': 'Camptocamp,Odoo Community Association (OCA)', 'author': 'Camptocamp,Odoo Community Association (OCA)',
'license': 'AGPL-3', 'license': 'AGPL-3',
'category': 'category', 'category': 'category',
+2 -2
View File
@@ -6,8 +6,8 @@ import json
import werkzeug import werkzeug
from openerp import http from odoo import http
from openerp.addons.web.controllers.main import ensure_db from odoo.addons.web.controllers.main import ensure_db
class Monitoring(http.Controller): class Monitoring(http.Controller):
+1 -1
View File
@@ -32,6 +32,6 @@ Limitations
Redis. Redis.
* All the users will have to login again as their previous session will be * All the users will have to login again as their previous session will be
dropped. dropped.
* The addon monkey-patch ``openerp.http.Root.session_store`` with a custom * The addon monkey-patch ``odoo.http.Root.session_store`` with a custom
method when the Redis mode is active, so incompatibilities with other addons method when the Redis mode is active, so incompatibilities with other addons
is possible if they do the same. is possible if they do the same.
@@ -5,7 +5,7 @@
{'name': 'Sessions in Redis', {'name': 'Sessions in Redis',
'summary': 'Store web sessions in Redis', 'summary': 'Store web sessions in Redis',
'version': '9.0.1.0.0', 'version': '10.0.1.0.0',
'author': 'Camptocamp,Odoo Community Association (OCA)', 'author': 'Camptocamp,Odoo Community Association (OCA)',
'license': 'AGPL-3', 'license': 'AGPL-3',
'category': 'Extra Tools', 'category': 'Extra Tools',
+4 -4
View File
@@ -7,9 +7,9 @@ import os
from distutils.util import strtobool from distutils.util import strtobool
import openerp import odoo
from openerp import http from odoo import http
from openerp.tools.func import lazy_property from odoo.tools.func import lazy_property
from .session import RedisSessionStore from .session import RedisSessionStore
@@ -65,4 +65,4 @@ if is_true(os.environ.get('ODOO_SESSION_REDIS')):
http.Root.session_store = session_store http.Root.session_store = session_store
http.session_gc = session_gc http.session_gc = session_gc
# clean the existing sessions on the file system # clean the existing sessions on the file system
purge_fs_sessions(openerp.tools.config.session_dir) purge_fs_sessions(odoo.tools.config.session_dir)
+1 -1
View File
@@ -8,7 +8,7 @@ import logging
from werkzeug.contrib.sessions import SessionStore from werkzeug.contrib.sessions import SessionStore
# this is equal to the duration of the session garbage collector in # this is equal to the duration of the session garbage collector in
# openerp.http.session_gc() # odoo.http.session_gc()
DEFAULT_SESSION_TIMEOUT = 60 * 60 * 24 * 7 # 7 days in seconds DEFAULT_SESSION_TIMEOUT = 60 * 60 * 24 * 7 # 7 days in seconds
_logger = logging.getLogger(__name__) _logger = logging.getLogger(__name__)