Browse Source

server_environment_ir_config_parameter: migrate to 10.0

pull/640/head
Stéphane Bidoul (ACSONE) 8 years ago
parent
commit
35da9d6d2d
No known key found for this signature in database GPG Key ID: 866D394B4986F82D
  1. 2
      server_environment_ir_config_parameter/README.rst
  2. 2
      server_environment_ir_config_parameter/__manifest__.py
  3. 14
      server_environment_ir_config_parameter/models/ir_config_parameter.py
  4. 6
      server_environment_ir_config_parameter/tests/test_server_environment_ircp.py
  5. 1
      setup/server_environment_ir_config_parameter/odoo/__init__.py
  6. 1
      setup/server_environment_ir_config_parameter/odoo/addons/__init__.py
  7. 1
      setup/server_environment_ir_config_parameter/odoo/addons/server_environment_ir_config_parameter
  8. 6
      setup/server_environment_ir_config_parameter/setup.py

2
server_environment_ir_config_parameter/README.rst

@ -38,7 +38,7 @@ For example you can use this module in combination with web_environment_ribbon:
.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas .. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
:alt: Try me on Runbot :alt: Try me on Runbot
:target: https://runbot.odoo-community.org/runbot/149/9.0
:target: https://runbot.odoo-community.org/runbot/149/10.0
Known issues / Roadmap Known issues / Roadmap
====================== ======================

2
server_environment_ir_config_parameter/__openerp__.py → server_environment_ir_config_parameter/__manifest__.py

@ -6,7 +6,7 @@
'name': 'Server Environment Ir Config Parameter', 'name': 'Server Environment Ir Config Parameter',
'summary': """ 'summary': """
Override System Parameters from server environment file""", Override System Parameters from server environment file""",
'version': '9.0.1.0.0',
'version': '10.0.1.0.0',
'license': 'AGPL-3', 'license': 'AGPL-3',
'author': 'ACSONE SA/NV,Odoo Community Association (OCA)', 'author': 'ACSONE SA/NV,Odoo Community Association (OCA)',
'website': 'https://odoo-community.org/', 'website': 'https://odoo-community.org/',

14
server_environment_ir_config_parameter/models/ir_config_parameter.py

@ -2,9 +2,9 @@
# Copyright 2016 ACSONE SA/NV # Copyright 2016 ACSONE SA/NV
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from openerp import api, models, _, SUPERUSER_ID
from openerp.exceptions import UserError
from openerp.addons.server_environment import serv_config
from odoo import api, models, _
from odoo.exceptions import UserError
from odoo.addons.server_environment import serv_config
SECTION = 'ir.config_parameter' SECTION = 'ir.config_parameter'
@ -14,9 +14,9 @@ class IrConfigParameter(models.Model):
_inherit = 'ir.config_parameter' _inherit = 'ir.config_parameter'
def get_param(self, cr, uid, key, default=False, context=None):
value = super(IrConfigParameter, self).get_param(
cr, uid, key, default=None, context=context)
@api.model
def get_param(self, key, default=False):
value = super(IrConfigParameter, self).get_param(key, default=None)
if serv_config.has_option(SECTION, key): if serv_config.has_option(SECTION, key):
cvalue = serv_config.get(SECTION, key) cvalue = serv_config.get(SECTION, key)
if not cvalue: if not cvalue:
@ -28,7 +28,7 @@ class IrConfigParameter(models.Model):
# should we have preloaded values in database at, # should we have preloaded values in database at,
# server startup, modules loading their parameters # server startup, modules loading their parameters
# from data files would break on unique key error. # from data files would break on unique key error.
self.set_param(cr, SUPERUSER_ID, key, cvalue)
self.set_param(key, cvalue)
value = cvalue value = cvalue
if value is None: if value is None:
return default return default

6
server_environment_ir_config_parameter/tests/test_server_environment_ircp.py

@ -4,9 +4,9 @@
from cStringIO import StringIO from cStringIO import StringIO
from openerp.exceptions import UserError
from openerp.tests import common
from openerp.tools import convert
from odoo.exceptions import UserError
from odoo.tests import common
from odoo.tools import convert
class TestEnv(common.TransactionCase): class TestEnv(common.TransactionCase):

1
setup/server_environment_ir_config_parameter/odoo/__init__.py

@ -0,0 +1 @@
__import__('pkg_resources').declare_namespace(__name__)

1
setup/server_environment_ir_config_parameter/odoo/addons/__init__.py

@ -0,0 +1 @@
__import__('pkg_resources').declare_namespace(__name__)

1
setup/server_environment_ir_config_parameter/odoo/addons/server_environment_ir_config_parameter

@ -0,0 +1 @@
../../../../server_environment_ir_config_parameter

6
setup/server_environment_ir_config_parameter/setup.py

@ -0,0 +1,6 @@
import setuptools
setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)
Loading…
Cancel
Save