diff --git a/base_jsonify/__manifest__.py b/base_jsonify/__manifest__.py index d209dbe61..02047eb9a 100644 --- a/base_jsonify/__manifest__.py +++ b/base_jsonify/__manifest__.py @@ -6,12 +6,11 @@ { "name": "Base Jsonify", "summary": "Base module that provide the jsonify method on all models", - "version": "10.0.1.0.0", + "version": "12.0.1.0.0", "category": "Uncategorized", "website": "https://github.com/OCA/server-tools", "author": "Akretion, Odoo Community Association (OCA)", "license": "AGPL-3", - "application": False, "installable": True, "depends": [ "base", diff --git a/base_jsonify/models/ir_export.py b/base_jsonify/models/ir_export.py index c9c59c93c..e14db51bd 100644 --- a/base_jsonify/models/ir_export.py +++ b/base_jsonify/models/ir_export.py @@ -7,12 +7,15 @@ from odoo import api, models def update_dict(data, fields): - """ - Contruct a tree of fields. - ie: { - "name": True, - "resource": True, + """Contruct a tree of fields. + + Example: + + { + "name": True, + "resource": True, } + Order of keys is important. """ field = fields[0] @@ -27,10 +30,9 @@ def update_dict(data, fields): def convert_dict(dict_parser): - """ - Converts the dict returned by update_dict to a list consistent with the - Odoo API. The list is composed of strings (field names or aliases) or - tuples. + """Convert dict returned by update_dict to list consistent w/ Odoo API. + + The list is composed of strings (field names or aliases) or tuples. """ parser = [] for field, value in dict_parser.items(): @@ -46,9 +48,9 @@ class IrExport(models.Model): @api.multi def get_json_parser(self): - """ - Creates a parser from a ir_exports record and returns it. This parser - can then be used to "jsonify" records of the ir_export's model. + """Creates a parser from ir.exports record and return it. + + The final parser can be used to "jsonify" records of ir.export's model. """ self.ensure_one() dict_parser = OrderedDict() diff --git a/base_jsonify/models/models.py b/base_jsonify/models/models.py index 697b38528..f05513044 100644 --- a/base_jsonify/models/models.py +++ b/base_jsonify/models/models.py @@ -14,9 +14,7 @@ class Base(models.AbstractModel): @api.model def __parse_field(self, parser_field): - """ - Deducts how to handle a field from its parser - """ + """Deduct how to handle a field from its parser.""" field_name = parser_field subparser = None if isinstance(parser_field, tuple): @@ -28,7 +26,8 @@ class Base(models.AbstractModel): @api.multi def jsonify(self, parser): - """ Convert the record according to the parser given + """Convert the record according to the given parser. + Example of parser: parser = [ 'name', diff --git a/base_jsonify/readme/DESCRIPTION.rst b/base_jsonify/readme/DESCRIPTION.rst index ff92efef6..115e75c0d 100644 --- a/base_jsonify/readme/DESCRIPTION.rst +++ b/base_jsonify/readme/DESCRIPTION.rst @@ -25,7 +25,7 @@ can define your mapping as follow into the parser definition: .. code-block:: python parser = [ - 'field_name:json_key' + 'field_name:json_key' ] .. code-block:: python @@ -40,4 +40,4 @@ can define your mapping as follow into the parser definition: ] Also the module provide a method "get_json_parser" on the ir.exports object -that generate a parser from an ir.exports configuration +that generate a parser from an ir.exports configuration. diff --git a/base_jsonify/tests/test_get_parser.py b/base_jsonify/tests/test_get_parser.py index 70756754c..6e421141d 100644 --- a/base_jsonify/tests/test_get_parser.py +++ b/base_jsonify/tests/test_get_parser.py @@ -1,4 +1,4 @@ -# © +# Copyright 2017 ACSONE SA/NV # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). from odoo.tests.common import TransactionCase diff --git a/base_jsonify/tests/test_ir_exports_line.py b/base_jsonify/tests/test_ir_exports_line.py index 9d7e52631..2916f8487 100644 --- a/base_jsonify/tests/test_ir_exports_line.py +++ b/base_jsonify/tests/test_ir_exports_line.py @@ -1,4 +1,4 @@ -# © 2017 ACSONE SA/NV +# Copyright 2017 ACSONE SA/NV # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). from odoo.exceptions import ValidationError