diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 9bd2b6c51..f92e933ea 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -7,7 +7,6 @@ exclude: |
^base_rest_auth_user_service/|
^base_rest_datamodel/|
^base_rest_demo/|
- ^datamodel/|
^graphql_base/|
^graphql_demo/|
^model_serializer/|
diff --git a/datamodel/README.rst b/datamodel/README.rst
index cbb7bd357..612c94d71 100644
--- a/datamodel/README.rst
+++ b/datamodel/README.rst
@@ -14,13 +14,13 @@ Datamodel
:target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html
:alt: License: LGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Frest--framework-lightgray.png?logo=github
- :target: https://github.com/OCA/rest-framework/tree/14.0/datamodel
+ :target: https://github.com/OCA/rest-framework/tree/15.0/datamodel
:alt: OCA/rest-framework
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/rest-framework-14-0/rest-framework-14-0-datamodel
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
- :target: https://runbot.odoo-community.org/runbot/271/14.0
+ :target: https://runbot.odoo-community.org/runbot/271/15.0
:alt: Try me on Runbot
|badge1| |badge2| |badge3| |badge4| |badge5|
@@ -129,7 +129,7 @@ Bug Tracker
Bugs are tracked on `GitHub Issues `_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed
-`feedback `_.
+`feedback `_.
Do not contact contributors directly about support or help with technical issues.
@@ -170,6 +170,6 @@ Current `maintainer `__:
|maintainer-lmignon|
-This module is part of the `OCA/rest-framework `_ project on GitHub.
+This module is part of the `OCA/rest-framework `_ project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
diff --git a/datamodel/__manifest__.py b/datamodel/__manifest__.py
index dbaf5ebcb..dcb81f855 100644
--- a/datamodel/__manifest__.py
+++ b/datamodel/__manifest__.py
@@ -6,7 +6,7 @@
"summary": """
This addon allows you to define simple data models supporting
serialization/deserialization""",
- "version": "14.0.3.0.4",
+ "version": "15.0.1.0.0",
"license": "LGPL-3",
"development_status": "Beta",
"author": "ACSONE SA/NV, " "Odoo Community Association (OCA)",
@@ -16,5 +16,5 @@
"data": [],
"demo": [],
"external_dependencies": {"python": ["marshmallow", "marshmallow-objects>=2.0.0"]},
- "installable": False,
+ "installable": True,
}
diff --git a/datamodel/core.py b/datamodel/core.py
index ee6c5a25e..a6770e424 100644
--- a/datamodel/core.py
+++ b/datamodel/core.py
@@ -53,7 +53,7 @@ def _get_nested_schemas(schema):
class DatamodelDatabases(dict):
- """ Holds a registry of datamodels for each database """
+ """Holds a registry of datamodels for each database"""
class DatamodelRegistry(object):
@@ -213,7 +213,7 @@ def __init__(self, context=None, partial=None, env=None, **kwargs):
@property
def env(self):
- """ Current datamodels registry"""
+ """Current datamodels registry"""
return self._env
@classmethod
diff --git a/datamodel/i18n/datamodel.pot b/datamodel/i18n/datamodel.pot
index 863ff8e72..f40a393b3 100644
--- a/datamodel/i18n/datamodel.pot
+++ b/datamodel/i18n/datamodel.pot
@@ -4,7 +4,7 @@
#
msgid ""
msgstr ""
-"Project-Id-Version: Odoo Server 14.0\n"
+"Project-Id-Version: Odoo Server 15.0\n"
"Report-Msgid-Bugs-To: \n"
"Last-Translator: \n"
"Language-Team: \n"
diff --git a/datamodel/static/description/index.html b/datamodel/static/description/index.html
index 2f02b363c..f52cf1542 100644
--- a/datamodel/static/description/index.html
+++ b/datamodel/static/description/index.html
@@ -367,7 +367,7 @@ Datamodel
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
-

+

This addon allows you to define simple data models supporting serialization/deserialization
to/from json
Datamodels are Marshmallow models classes that can be inherited as Odoo
@@ -468,7 +468,7 @@
Bugs are tracked on GitHub Issues.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed
-feedback.
+feedback.
Do not contact contributors directly about support or help with technical issues.
diff --git a/datamodel/tests/common.py b/datamodel/tests/common.py
index 1eb530654..9594ff3da 100644
--- a/datamodel/tests/common.py
+++ b/datamodel/tests/common.py
@@ -60,7 +60,7 @@ def notready():
class TransactionDatamodelCase(common.TransactionCase, DatamodelMixin):
"""A TransactionCase that loads all the datamodels
- It it used like an usual Odoo's TransactionCase, but it ensures
+ It is used like an usual Odoo's TransactionCase, but it ensures
that all the datamodels of the current addon and its dependencies
are loaded.
@@ -68,7 +68,7 @@ class TransactionDatamodelCase(common.TransactionCase, DatamodelMixin):
@classmethod
def setUpClass(cls):
- super(TransactionDatamodelCase, cls).setUpClass()
+ super().setUpClass()
cls.setUpDatamodel()
# pylint: disable=W8106
@@ -79,30 +79,8 @@ def setUp(self):
DatamodelMixin.setUp(self)
-class SavepointDatamodelCase(common.SavepointCase, DatamodelMixin):
- """A SavepointCase that loads all the datamodels
-
- It is used like an usual Odoo's SavepointCase, but it ensures
- that all the datamodels of the current addon and its dependencies
- are loaded.
-
- """
-
- @classmethod
- def setUpClass(cls):
- super(SavepointDatamodelCase, cls).setUpClass()
- cls.setUpDatamodel()
-
- # pylint: disable=W8106
- def setUp(self):
- # resolve an inheritance issue (common.SavepointCase does not call
- # super)
- common.SavepointCase.setUp(self)
- DatamodelMixin.setUp(self)
-
-
class DatamodelRegistryCase(
- common.TreeCase, common.MetaCase("DummyCase", (object,), {})
+ common.BaseCase, common.MetaCase("DummyCase", (object,), {})
):
"""This test case can be used as a base for writings tests on datamodels
@@ -111,10 +89,9 @@ class DatamodelRegistryCase(
or not, or when you want to create additional datamodels in your tests.
If you only want to *use* the datamodels of the tested addon in your tests,
- then consider using one of:
+ then consider using:
* :class:`TransactionDatamodelCase`
- * :class:`SavepointDatamodelCase`
This test case creates a special
:class:`odoo.addons.datamodel.core.DatamodelRegistry` for the purpose of
@@ -136,8 +113,7 @@ class DatamodelRegistryCase(
"""
def setUp(self):
- super(DatamodelRegistryCase, self).setUp()
-
+ super().setUp()
# keep the original classes registered by the metaclass
# so we'll restore them at the end of the tests, it avoid
# to pollute it with Stub / Test datamodels
@@ -179,7 +155,7 @@ def _close_and_roolback():
self.datamodel_registry.ready = True
def tearDown(self):
- super(DatamodelRegistryCase, self).tearDown()
+ super().tearDown()
# restore the original metaclass' classes
MetaDatamodel._modules_datamodels = self._original_datamodels
@@ -192,32 +168,18 @@ def _build_datamodels(self, *classes):
class TransactionDatamodelRegistryCase(common.TransactionCase, DatamodelRegistryCase):
- """ Adds Odoo Transaction in the base Datamodel TestCase """
+ """Adds Odoo Transaction in the base Datamodel TestCase"""
# pylint: disable=W8106
- def setUp(self):
+ @classmethod
+ def setUpClass(cls):
# resolve an inheritance issue (common.TransactionCase does not use
# super)
- common.TransactionCase.setUp(self)
- DatamodelRegistryCase.setUp(self)
- self.collection = self.env["collection.base"]
-
- def teardown(self):
- common.TransactionCase.tearDown(self)
- DatamodelRegistryCase.tearDown(self)
-
-
-class SavepointDatamodelRegistryCase(common.SavepointCase, DatamodelRegistryCase):
- """ Adds Odoo Transaction with Savepoint in the base Datamodel TestCase """
-
- # pylint: disable=W8106
- def setUp(self):
- # resolve an inheritance issue (common.SavepointCase does not use
- # super)
- common.SavepointCase.setUp(self)
- DatamodelRegistryCase.setUp(self)
- self.collection = self.env["collection.base"]
+ common.TransactionCase.setUpClass(cls)
+ DatamodelRegistryCase.setUp(cls)
+ cls.collection = cls.env["collection.base"]
- def teardown(self):
- common.SavepointCase.tearDown(self)
- DatamodelRegistryCase.tearDown(self)
+ @classmethod
+ def tearDownClass(cls):
+ common.TransactionCase.tearDownClass(cls)
+ DatamodelRegistryCase.tearDown(cls)
diff --git a/datamodel/tests/test_build_datamodel.py b/datamodel/tests/test_build_datamodel.py
index f36cb8fdc..b0ff97f06 100644
--- a/datamodel/tests/test_build_datamodel.py
+++ b/datamodel/tests/test_build_datamodel.py
@@ -40,7 +40,7 @@ class Datamodel2(Datamodel):
self.assertIsInstance(Datamodel2(), MarshmallowModel)
def test_no_name(self):
- """ Ensure that a datamodel has a _name """
+ """Ensure that a datamodel has a _name"""
class Datamodel1(Datamodel):
pass
@@ -50,7 +50,7 @@ class Datamodel1(Datamodel):
Datamodel1._build_datamodel(self.datamodel_registry)
def test_register(self):
- """ Able to register datamodels in datamodels registry """
+ """Able to register datamodels in datamodels registry"""
class Datamodel1(Datamodel):
_name = "datamodel1"
@@ -66,8 +66,9 @@ class Datamodel2(Datamodel):
["base", "datamodel1", "datamodel2"], list(self.datamodel_registry)
)
+ # pylint: disable=R7980
def test_inherit_bases(self):
- """ Check __bases__ of Datamodel with _inherit """
+ """Check __bases__ of Datamodel with _inherit"""
class Datamodel1(Datamodel):
_name = "datamodel1"
@@ -90,7 +91,7 @@ class Datamodel3(Datamodel):
)
def test_prototype_inherit_bases(self):
- """ Check __bases__ of Datamodel with _inherit and different _name """
+ """Check __bases__ of Datamodel with _inherit and different _name"""
class Datamodel1(Datamodel):
_name = "datamodel1"
@@ -188,7 +189,7 @@ class Datamodel4(Datamodel):
)
def test_custom_build(self):
- """ Check that we can hook at the end of a Datamodel build """
+ """Check that we can hook at the end of a Datamodel build"""
class Datamodel1(Datamodel):
_name = "datamodel1"
@@ -203,8 +204,9 @@ def _complete_datamodel_build(cls):
# we inspect that our custom build has been executed
self.assertTrue(self.env.datamodels["datamodel1"]._build_done)
+ # pylint: disable=W8110
def test_inherit_attrs(self):
- """ Check attributes inheritance of Datamodels with _inherit """
+ """Check attributes inheritance of Datamodels with _inherit"""
class Datamodel1(Datamodel):
_name = "datamodel1"
@@ -236,7 +238,7 @@ def say(self):
self.assertEqual("foo bar", datamodel2.say())
def test_duplicate_datamodel(self):
- """ Check that we can't have 2 datamodels with the same name """
+ """Check that we can't have 2 datamodels with the same name"""
class Datamodel1(Datamodel):
_name = "datamodel1"
@@ -250,7 +252,7 @@ class Datamodel2(Datamodel):
Datamodel2._build_datamodel(self.datamodel_registry)
def test_no_parent(self):
- """ Ensure we can't _inherit a non-existent datamodel """
+ """Ensure we can't _inherit a non-existent datamodel"""
class Datamodel1(Datamodel):
_name = "datamodel1"
@@ -261,7 +263,7 @@ class Datamodel1(Datamodel):
Datamodel1._build_datamodel(self.datamodel_registry)
def test_no_parent2(self):
- """ Ensure we can't _inherit by prototype a non-existent datamodel """
+ """Ensure we can't _inherit by prototype a non-existent datamodel"""
class Datamodel1(Datamodel):
_name = "datamodel1"
@@ -276,7 +278,7 @@ class Datamodel2(Datamodel):
Datamodel2._build_datamodel(self.datamodel_registry)
def test_add_inheritance(self):
- """ Ensure we can add a new inheritance """
+ """Ensure we can add a new inheritance"""
class Datamodel1(Datamodel):
_name = "datamodel1"
@@ -339,7 +341,7 @@ class Datamodel1(Datamodel):
self.env.datamodels["datamodel1"](field_str="1234")
def test_nested_model(self):
- """ Test nested model serialization/deserialization"""
+ """Test nested model serialization/deserialization"""
class Parent(Datamodel):
_name = "parent"
@@ -366,7 +368,7 @@ class Child(Datamodel):
self.assertEqual(new_instance.child.field_str, instance.child.field_str)
def test_list_nested_model(self):
- """ Test list model of nested model serialization/deserialization"""
+ """Test list model of nested model serialization/deserialization"""
class Parent(Datamodel):
_name = "parent"
diff --git a/requirements.txt b/requirements.txt
new file mode 100644
index 000000000..011255bd6
--- /dev/null
+++ b/requirements.txt
@@ -0,0 +1,3 @@
+# generated from manifests external_dependencies
+marshmallow
+marshmallow-objects>=2.0.0
diff --git a/setup/datamodel/odoo/addons/datamodel b/setup/datamodel/odoo/addons/datamodel
new file mode 120000
index 000000000..790184d6e
--- /dev/null
+++ b/setup/datamodel/odoo/addons/datamodel
@@ -0,0 +1 @@
+../../../../datamodel
\ No newline at end of file
diff --git a/setup/datamodel/setup.py b/setup/datamodel/setup.py
new file mode 100644
index 000000000..28c57bb64
--- /dev/null
+++ b/setup/datamodel/setup.py
@@ -0,0 +1,6 @@
+import setuptools
+
+setuptools.setup(
+ setup_requires=['setuptools-odoo'],
+ odoo_addon=True,
+)