From 53133a6eeb7f66d22628503403abdaba4a48b21d Mon Sep 17 00:00:00 2001 From: Pierrick Brun Date: Mon, 8 Oct 2018 10:57:51 +0200 Subject: [PATCH] base_jsonify: Use readme fragment mechanism --- base_jsonify/README.rst | 87 ++--- base_jsonify/readme/CONTRIBUTORS.rst | 3 + base_jsonify/readme/DESCRIPTION.rst | 42 ++ base_jsonify/static/description/index.html | 431 +++++++++++++++++++++ 4 files changed, 519 insertions(+), 44 deletions(-) create mode 100644 base_jsonify/readme/CONTRIBUTORS.rst create mode 100644 base_jsonify/readme/DESCRIPTION.rst create mode 100644 base_jsonify/static/description/index.html diff --git a/base_jsonify/README.rst b/base_jsonify/README.rst index d50eb10ba..65ffe69ef 100644 --- a/base_jsonify/README.rst +++ b/base_jsonify/README.rst @@ -1,11 +1,30 @@ -.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg - :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html - :alt: License: AGPL-3 - ============ Base Jsonify ============ +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png + :target: https://odoo-community.org/page/development-status + :alt: Beta +.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png + :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/10.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-10-0/server-tools-10-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/10.0 + :alt: Try me on Runbot + +|badge1| |badge2| |badge3| |badge4| |badge5| + This module add the jsonify method to the ORM. This method take as argument the browse record and the "parser" that specify the field to extract. @@ -49,69 +68,49 @@ 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 +**Table of contents** - -Installation -============ - -To install this module, you need to install it - -Configuration -============= - -No configuration required - -Usage -===== - -This is a technical module not function feature is added - -.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas - :alt: Try me on Runbot - :target: https://runbot.odoo-community.org/runbot/{repo_id}/{branch} - -.. repo_id is available in https://github.com/OCA/maintainer-tools/blob/master/tools/repos_with_ids.txt -.. branch is "8.0" for example - -Known issues / Roadmap -====================== - -No distinction between float 0.0L and no value +.. contents:: + :local: 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. +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 `_. + +Do not contact contributors directly about support or help with technical issues. Credits ======= -Images ------- +Authors +~~~~~~~ -* Odoo Community Association: `Icon `_. +* Akretion Contributors ------------- +~~~~~~~~~~~~ * BEAU Sébastien * Raphaël Reverdy * Laurent Mignon -Maintainer ----------- +Maintainers +~~~~~~~~~~~ + +This module is maintained by the OCA. .. image:: https://odoo-community.org/logo.png :alt: Odoo Community Association :target: https://odoo-community.org -This module is maintained by the OCA. - 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. -To contribute to this module, please visit https://odoo-community.org. +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/readme/CONTRIBUTORS.rst b/base_jsonify/readme/CONTRIBUTORS.rst new file mode 100644 index 000000000..717c76041 --- /dev/null +++ b/base_jsonify/readme/CONTRIBUTORS.rst @@ -0,0 +1,3 @@ +* BEAU Sébastien +* Raphaël Reverdy +* Laurent Mignon diff --git a/base_jsonify/readme/DESCRIPTION.rst b/base_jsonify/readme/DESCRIPTION.rst new file mode 100644 index 000000000..25c62fbb3 --- /dev/null +++ b/base_jsonify/readme/DESCRIPTION.rst @@ -0,0 +1,42 @@ +This module add the jsonify method to the ORM. This method take as argument +the browse record and the "parser" that specify the field to extract. + +Example of parser: + + +.. code-block:: python + + parser = [ + 'name', + 'number', + 'create_date', + ('partner_id', ['id', 'display_name', 'ref']) + ('line_id', ['id', ('product_id', ['name']), 'price_unit']) + ] + +In order to be consitent with the odoo api the jsonify method always +return a list of object even if there is only one element in input + +By default the key into the json is the name of the field extracted +from the model. If you need to specify an alternate name to use as key, you +can define your mapping as follow into the parser definition: + +.. code-block:: python + + parser = [ + 'field_name:json_key' + ] + +.. code-block:: python + + + parser = [ + 'name', + 'number', + 'create_date:creationDate', + ('partner_id:partners', ['id', 'display_name', 'ref']) + ('line_id:lines', ['id', ('product_id', ['name']), 'price_unit']) + ] + +Also the module provide a method "get_json_parser" on the ir.exports object +that generate a parser from an ir.exports configuration diff --git a/base_jsonify/static/description/index.html b/base_jsonify/static/description/index.html new file mode 100644 index 000000000..a4065b092 --- /dev/null +++ b/base_jsonify/static/description/index.html @@ -0,0 +1,431 @@ + + + + + + +Base Jsonify + + + +
+

Base Jsonify

+ + +

Beta License: AGPL-3 OCA/server-tools Translate me on Weblate Try me on Runbot

+

This module add the jsonify method to the ORM. This method take as argument +the browse record and the “parser” that specify the field to extract.

+

Example of parser:

+
+parser = [
+    'name',
+    'number',
+    'create_date',
+    ('partner_id', ['id', 'display_name', 'ref'])
+    ('line_id', ['id', ('product_id', ['name']), 'price_unit'])
+]
+
+

In order to be consitent with the odoo api the jsonify method always +return a list of object even if there is only one element in input

+

By default the key into the json is the name of the field extracted +from the model. If you need to specify an alternate name to use as key, you +can define your mapping as follow into the parser definition:

+
+parser = [
+     'field_name:json_key'
+]
+
+
+parser = [
+    'name',
+    'number',
+    'create_date:creationDate',
+    ('partner_id:partners', ['id', 'display_name', 'ref'])
+    ('line_id:lines', ['id', ('product_id', ['name']), 'price_unit'])
+]
+
+

Also the module provide a method “get_json_parser” on the ir.exports object +that generate a parser from an ir.exports configuration

+

Table of contents

+ +
+

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.

+

Do not contact contributors directly about support or help with technical issues.

+
+
+

Credits

+
+

Authors

+
    +
  • Akretion
  • +
+
+
+

Contributors

+ +
+
+

Maintainers

+

This module is maintained by the OCA.

+Odoo Community Association +

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.

+

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

+
+
+
+ +