summaryrefslogtreecommitdiff
path: root/odoo/addons
diff options
context:
space:
mode:
authorChristophe Simonis <chs@odoo.com>2019-06-07 11:38:48 +0200
committerChristophe Simonis <chs@odoo.com>2019-06-07 11:38:48 +0200
commit9bf4766f3dcc0a39c77eee4f51f5ca4192a259f8 (patch)
tree3125705b9d0e121b271cafbb61b04d1d6b0f4aa3 /odoo/addons
parentd7d7d92e92aa4bc5d81c77b41c8e41f4ee479777 (diff)
parent6c6e652673c8fb830e4de81f9683eb9e8609fdf8 (diff)
[MERGE] forward port branch saas-15 up to 6c6e652673c
Diffstat (limited to 'odoo/addons')
-rw-r--r--odoo/addons/base/ir/ir_actions.py8
-rw-r--r--odoo/addons/base/ir/ir_model.py11
-rw-r--r--odoo/addons/test_lint/__init__.py13
-rw-r--r--odoo/addons/test_lint/__manifest__.py12
-rw-r--r--odoo/addons/test_lint/tests/__init__.py2
-rw-r--r--odoo/addons/test_lint/tests/test_ecmascript.py48
-rw-r--r--odoo/addons/test_lint/tests/test_pylint.py (renamed from odoo/addons/test_pylint/tests/test_pylint.py)0
-rw-r--r--odoo/addons/test_pylint/__manifest__.py2
-rw-r--r--odoo/addons/test_pylint/tests/__init__.py1
9 files changed, 90 insertions, 7 deletions
diff --git a/odoo/addons/base/ir/ir_actions.py b/odoo/addons/base/ir/ir_actions.py
index bec32692acc..7fad2116fd9 100644
--- a/odoo/addons/base/ir/ir_actions.py
+++ b/odoo/addons/base/ir/ir_actions.py
@@ -732,3 +732,11 @@ class IrActionsActClient(models.Model):
for record in self:
params = record.params
record.params_store = repr(params) if isinstance(params, dict) else params
+
+ def _get_default_form_view(self):
+ doc = super(IrActionsActClient, self)._get_default_form_view()
+ params = doc.find(".//field[@name='params']")
+ params.getparent().remove(params)
+ params_store = doc.find(".//field[@name='params_store']")
+ params_store.getparent().remove(params_store)
+ return doc
diff --git a/odoo/addons/base/ir/ir_model.py b/odoo/addons/base/ir/ir_model.py
index 3fd619c1a9a..369775161f6 100644
--- a/odoo/addons/base/ir/ir_model.py
+++ b/odoo/addons/base/ir/ir_model.py
@@ -697,7 +697,7 @@ class IrModelFields(models.Model):
item._prepare_update()
if column_rename:
raise UserError(_('Can only rename one field at a time!'))
- column_rename = (obj._table, item.name, vals['name'], item.index)
+ column_rename = (obj._table, item.name, vals['name'], item.index, item.store)
# We don't check the 'state', because it might come from the context
# (thus be set for multiple fields) and will be ignored anyway.
@@ -715,10 +715,11 @@ class IrModelFields(models.Model):
if column_rename:
# rename column in database, and its corresponding index if present
- table, oldname, newname, index = column_rename
- self._cr.execute('ALTER TABLE "%s" RENAME COLUMN "%s" TO "%s"' % (table, oldname, newname))
- if index:
- self._cr.execute('ALTER INDEX "%s_%s_index" RENAME TO "%s_%s_index"' % (table, oldname, table, newname))
+ table, oldname, newname, index, stored = column_rename
+ if stored:
+ self._cr.execute('ALTER TABLE "%s" RENAME COLUMN "%s" TO "%s"' % (table, oldname, newname))
+ if index:
+ self._cr.execute('ALTER INDEX "%s_%s_index" RENAME TO "%s_%s_index"' % (table, oldname, table, newname))
if column_rename or patched_models:
# setup models, this will reload all manual fields in registry
diff --git a/odoo/addons/test_lint/__init__.py b/odoo/addons/test_lint/__init__.py
new file mode 100644
index 00000000000..0e68430dabe
--- /dev/null
+++ b/odoo/addons/test_lint/__init__.py
@@ -0,0 +1,13 @@
+# -*- coding: utf-8 -*-
+# Part of Odoo. See LICENSE file for full copyright and licensing details.
+
+from odoo import api, SUPERUSER_ID
+
+
+# TO REMOVE in master
+def uninstall_test_pylint(cr):
+ env = api.Environment(cr, SUPERUSER_ID, {})
+ env['ir.module.module'].search([
+ ('name', '=', 'test_pylint'),
+ ('state', '=', 'installed')
+ ]).write({'state': 'uninstalled'})
diff --git a/odoo/addons/test_lint/__manifest__.py b/odoo/addons/test_lint/__manifest__.py
new file mode 100644
index 00000000000..554e20ba3b2
--- /dev/null
+++ b/odoo/addons/test_lint/__manifest__.py
@@ -0,0 +1,12 @@
+# -*- coding: utf-8 -*-
+{
+ 'name': 'test-lint',
+ 'version': '0.1',
+ 'category': 'Tests',
+ 'description': """A module to test Odoo code with various linters.""",
+ 'maintainer': 'Odoo SA',
+ 'depends': ['base'],
+ 'installable': True,
+ 'auto_install': False,
+ 'pre_init_hook': 'uninstall_test_pylint'
+}
diff --git a/odoo/addons/test_lint/tests/__init__.py b/odoo/addons/test_lint/tests/__init__.py
new file mode 100644
index 00000000000..d085060f6bf
--- /dev/null
+++ b/odoo/addons/test_lint/tests/__init__.py
@@ -0,0 +1,2 @@
+from . import test_pylint
+from . import test_ecmascript
diff --git a/odoo/addons/test_lint/tests/test_ecmascript.py b/odoo/addons/test_lint/tests/test_ecmascript.py
new file mode 100644
index 00000000000..46008b0587d
--- /dev/null
+++ b/odoo/addons/test_lint/tests/test_ecmascript.py
@@ -0,0 +1,48 @@
+# -*- coding: utf-8 -*-
+# Part of Odoo. See LICENSE file for full copyright and licensing details.
+
+import logging
+import os
+import re
+import subprocess
+from unittest import skipIf
+from odoo.tests.common import TransactionCase
+from odoo import tools
+from odoo.modules import get_modules, get_module_path
+
+MAX_ES_VERSION = 'es5'
+
+_logger = logging.getLogger(__name__)
+
+try:
+ es_check = tools.misc.find_in_path('es-check')
+except IOError:
+ es_check = None
+
+
+@skipIf(es_check is None, "es-check tool not found on this system")
+class TestECMAScriptVersion(TransactionCase):
+
+ longMessage = True
+
+ def test_ecmascript_version(self):
+ """ Test that there is no unsupported ecmascript in javascript files """
+
+ black_re = re.compile(r'summernote.+(intro\.js|outro.js)$')
+
+ mod_paths = [get_module_path(m) for m in get_modules()]
+ files_to_check = []
+ for p in mod_paths:
+ for dp, _, file_names in os.walk(p):
+ if 'static/test' in dp:
+ continue
+ for fn in file_names:
+ fullpath_name = os.path.join(dp, fn)
+ if fullpath_name.endswith('.js') and not black_re.search(fullpath_name):
+ files_to_check.append(fullpath_name)
+
+ _logger.info('Testing %s js files', len(files_to_check))
+ cmd = [es_check, MAX_ES_VERSION] + files_to_check
+ process = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+ out, err = process.communicate()
+ self.assertEqual(process.returncode, 0, msg=out)
diff --git a/odoo/addons/test_pylint/tests/test_pylint.py b/odoo/addons/test_lint/tests/test_pylint.py
index dcea3ba01b1..dcea3ba01b1 100644
--- a/odoo/addons/test_pylint/tests/test_pylint.py
+++ b/odoo/addons/test_lint/tests/test_pylint.py
diff --git a/odoo/addons/test_pylint/__manifest__.py b/odoo/addons/test_pylint/__manifest__.py
index 66f801454a5..42e9d621f71 100644
--- a/odoo/addons/test_pylint/__manifest__.py
+++ b/odoo/addons/test_pylint/__manifest__.py
@@ -3,7 +3,7 @@
'name': 'test-eval',
'version': '0.1',
'category': 'Tests',
- 'description': """A module to test Odoo with pylint.""",
+ 'description': """Deprecated empty module in favor of test-lint.""",
'maintainer': 'Odoo SA',
'depends': ['base'],
'installable': True,
diff --git a/odoo/addons/test_pylint/tests/__init__.py b/odoo/addons/test_pylint/tests/__init__.py
deleted file mode 100644
index 66bc70c522e..00000000000
--- a/odoo/addons/test_pylint/tests/__init__.py
+++ /dev/null
@@ -1 +0,0 @@
-from . import test_pylint