diff --git a/base_jsonify/README.rst b/base_jsonify/README.rst index 6eb127470..732664115 100644 --- a/base_jsonify/README.rst +++ b/base_jsonify/README.rst @@ -14,13 +14,13 @@ Base Jsonify :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html :alt: License: AGPL-3 .. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fserver--tools-lightgray.png?logo=github - :target: https://github.com/OCA/server-tools/tree/13.0/base_jsonify + :target: https://github.com/OCA/server-tools/tree/14.0/base_jsonify :alt: OCA/server-tools .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png - :target: https://translation.odoo-community.org/projects/server-tools-13-0/server-tools-13-0-base_jsonify + :target: https://translation.odoo-community.org/projects/server-tools-14-0/server-tools-14-0-base_jsonify :alt: Translate me on Weblate .. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png - :target: https://runbot.odoo-community.org/runbot/149/13.0 + :target: https://runbot.odoo-community.org/runbot/149/14.0 :alt: Try me on Runbot |badge1| |badge2| |badge3| |badge4| |badge5| @@ -200,7 +200,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. @@ -233,6 +233,6 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use. -This module is part of the `OCA/server-tools `_ project on GitHub. +This module is part of the `OCA/server-tools `_ project on GitHub. You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/base_jsonify/__manifest__.py b/base_jsonify/__manifest__.py index 4af39bd15..997167339 100644 --- a/base_jsonify/__manifest__.py +++ b/base_jsonify/__manifest__.py @@ -6,7 +6,7 @@ { "name": "Base Jsonify", "summary": "Base module that provide the jsonify method on all models", - "version": "13.0.3.0.0", + "version": "14.0.1.0.0", "category": "Uncategorized", "website": "https://github.com/OCA/server-tools", "author": "Akretion, Odoo Community Association (OCA)", diff --git a/base_jsonify/migrations/13.0.2.0.0/pre-migrate.py b/base_jsonify/migrations/13.0.2.0.0/pre-migrate.py deleted file mode 100644 index 60aa19d56..000000000 --- a/base_jsonify/migrations/13.0.2.0.0/pre-migrate.py +++ /dev/null @@ -1,8 +0,0 @@ -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). - -from openupgradelib import openupgrade - - -@openupgrade.migrate() -def migrate(env, version): - openupgrade.rename_columns(env.cr, {"ir_exports_line": [("alias", "target")]}) diff --git a/base_jsonify/models/ir_export.py b/base_jsonify/models/ir_export.py index 92357a561..6b7606f01 100644 --- a/base_jsonify/models/ir_export.py +++ b/base_jsonify/models/ir_export.py @@ -8,15 +8,15 @@ from odoo import fields, models from odoo.tools import ormcache -def partition(l, accessor): +def partition(line, accessor): """Partition a recordset according to an accessor (e.g. a lambda). - Returns a dictionary whose keys are the values obtained from accessor, - and values are the items that have this value. - Example: partition([{"name": "ax"}, {"name": "by"}], lambda x: "x" in x["name"]) - => {True: [{"name": "ax"}], False: [{"name": "by"}]} + Returns a dictionary whose keys are the values obtained from accessor, + and values are the items that have this value. + Example: partition([{"name": "ax"}, {"name": "by"}], lambda x: "x" in x["name"]) + => {True: [{"name": "ax"}], False: [{"name": "by"}]} """ result = {} - for item in l: + for item in line: key = accessor(item) if key not in result: result[key] = [] diff --git a/base_jsonify/models/ir_exports_resolver.py b/base_jsonify/models/ir_exports_resolver.py index e3e5324de..f61bd235a 100644 --- a/base_jsonify/models/ir_exports_resolver.py +++ b/base_jsonify/models/ir_exports_resolver.py @@ -17,8 +17,7 @@ help_message = [ class FieldResolver(models.Model): - """Arbitrary function to process a field or a dict at export time. - """ + """Arbitrary function to process a field or a dict at export time.""" _name = "ir.exports.resolver" _description = "Export Resolver" diff --git a/base_jsonify/models/utils.py b/base_jsonify/models/utils.py index a1184ae0d..bdeb6782d 100644 --- a/base_jsonify/models/utils.py +++ b/base_jsonify/models/utils.py @@ -6,7 +6,7 @@ def convert_simple_to_full_parser(parser): def _f(f, function=None): """Return a dict from the string encoding a field to export. - The : is used as a separator to specify a target, if any. + The : is used as a separator to specify a target, if any. """ field_split = f.split(":") field_dict = {"name": field_split[0]} @@ -19,7 +19,7 @@ def _f(f, function=None): def _convert_parser(parser): """Recursively process each list to replace encoding fields as string - by dicts specifying each attribute by its relevant key. + by dicts specifying each attribute by its relevant key. """ result = [] for line in parser: diff --git a/base_jsonify/tests/test_get_parser.py b/base_jsonify/tests/test_get_parser.py index 89ff72bb8..49d767910 100644 --- a/base_jsonify/tests/test_get_parser.py +++ b/base_jsonify/tests/test_get_parser.py @@ -233,8 +233,7 @@ class TestParser(SavepointCase): self.assertEqual(json["X"], "X") # added by global resolver def test_simple_parser_translations(self): - """The simple parser result should depend on the context language. - """ + """The simple parser result should depend on the context language.""" parser = ["name"] json = self.category.jsonify(parser)[0] json_fr = self.category_lang.jsonify(parser)[0] @@ -243,8 +242,7 @@ class TestParser(SavepointCase): self.assertEqual(json_fr["name"], self.translated_target) def test_simple_star_target_and_field_resolver(self): - """The simple parser result should depend on the context language. - """ + """The simple parser result should depend on the context language.""" code = ( "is_number = field_type in ('integer', 'float');" "ftype = 'NUMBER' if is_number else 'TEXT';" diff --git a/base_jsonify/tests/test_ir_exports_line.py b/base_jsonify/tests/test_ir_exports_line.py index 46060ef60..3f6a65cd0 100644 --- a/base_jsonify/tests/test_ir_exports_line.py +++ b/base_jsonify/tests/test_ir_exports_line.py @@ -7,7 +7,7 @@ from odoo.tests.common import TransactionCase class TestIrExportsLine(TransactionCase): def setUp(self): - super(TestIrExportsLine, self).setUp() + super().setUp() self.ir_export = self.env.ref("base_jsonify.ir_exp_partner") def test_target_contrains(self):