diff --git a/endpoint_jsonifier/README.rst b/endpoint_jsonifier/README.rst new file mode 100644 index 00000000..3108aefd --- /dev/null +++ b/endpoint_jsonifier/README.rst @@ -0,0 +1,106 @@ +================== +Endpoint JSONifier +================== + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:c489f1c433a471e326d71194064e6f8b3ebd1f3769e3f8cdaa8697e953a775a4 + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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-LGPL--3-blue.png + :target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html + :alt: License: LGPL-3 +.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fweb--api-lightgray.png?logo=github + :target: https://github.com/OCA/web-api/tree/18.0/endpoint_jsonifier + :alt: OCA/web-api +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/web-api-18-0/web-api-18-0-endpoint_jsonifier + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png + :target: https://runboat.odoo-community.org/builds?repo=OCA/web-api&target_branch=18.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This addon allows configuring an exporter for endpoints to be used in +code snippets. + +**Table of contents** + +.. contents:: + :local: + +Usage +===== + +This module by itself contains no business logic, but its configuration +can be used to manage endpoints' data export. + +For example: + +.. code:: python + + parser = endpoint.export_id.get_json_parser() + prod_domain = [("sale_ok", "=", True)] + prod_data = env["product.product"].search(prod_domain).jsonify(parser) + resp = Response(json.dumps(prod_data), content_type="application/json", status=200) + result = dict(response=resp) + +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 to smash it by providing a detailed and welcomed +`feedback `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +------- + +* Camptocamp + +Contributors +------------ + +- `Camptocamp SA `__: + + - Silvio Gregorini + +Maintainers +----------- + +This module is maintained by the OCA. + +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://odoo-community.org + +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. + +.. |maintainer-SilvioC2C| image:: https://github.com/SilvioC2C.png?size=40px + :target: https://github.com/SilvioC2C + :alt: SilvioC2C +.. |maintainer-simahawk| image:: https://github.com/simahawk.png?size=40px + :target: https://github.com/simahawk + :alt: simahawk + +Current `maintainers `__: + +|maintainer-SilvioC2C| |maintainer-simahawk| + +This module is part of the `OCA/web-api `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/endpoint_jsonifier/__init__.py b/endpoint_jsonifier/__init__.py new file mode 100644 index 00000000..0650744f --- /dev/null +++ b/endpoint_jsonifier/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/endpoint_jsonifier/__manifest__.py b/endpoint_jsonifier/__manifest__.py new file mode 100644 index 00000000..9244674c --- /dev/null +++ b/endpoint_jsonifier/__manifest__.py @@ -0,0 +1,18 @@ +# Copyright 2024 Camptocamp (http://camptocamp.com) +# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html). + +{ + "name": "Endpoint JSONifier", + "summary": "Allow to configure jsonifier parsers on endpoints", + "version": "18.0.1.0.0", + "category": "Uncategorized", + "website": "https://github.com/OCA/web-api", + "author": "Camptocamp, Odoo Community Association (OCA)", + "maintainers": ["SilvioC2C", "simahawk"], + "license": "LGPL-3", + "installable": True, + "depends": ["endpoint", "jsonifier"], + "data": [ + "views/endpoint_endpoint.xml", + ], +} diff --git a/endpoint_jsonifier/i18n/endpoint_jsonifier.pot b/endpoint_jsonifier/i18n/endpoint_jsonifier.pot new file mode 100644 index 00000000..3e177b30 --- /dev/null +++ b/endpoint_jsonifier/i18n/endpoint_jsonifier.pot @@ -0,0 +1,45 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * endpoint_jsonifier +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 14.0\n" +"Report-Msgid-Bugs-To: \n" +"Last-Translator: \n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: endpoint_jsonifier +#: model:ir.model.fields,field_description:endpoint_jsonifier.field_endpoint_mixin__display_name +msgid "Display Name" +msgstr "" + +#. module: endpoint_jsonifier +#: model:ir.model,name:endpoint_jsonifier.model_endpoint_mixin +msgid "Endpoint mixin" +msgstr "" + +#. module: endpoint_jsonifier +#: model_terms:ir.ui.view,arch_db:endpoint_jsonifier.endpoint_mixin_form_view +msgid "Export" +msgstr "" + +#. module: endpoint_jsonifier +#: model:ir.model.fields,field_description:endpoint_jsonifier.field_endpoint_endpoint__exporter_id +#: model:ir.model.fields,field_description:endpoint_jsonifier.field_endpoint_mixin__exporter_id +msgid "Exporter" +msgstr "" + +#. module: endpoint_jsonifier +#: model:ir.model.fields,field_description:endpoint_jsonifier.field_endpoint_mixin__id +msgid "ID" +msgstr "" + +#. module: endpoint_jsonifier +#: model:ir.model.fields,field_description:endpoint_jsonifier.field_endpoint_mixin____last_update +msgid "Last Modified on" +msgstr "" diff --git a/endpoint_jsonifier/i18n/it.po b/endpoint_jsonifier/i18n/it.po new file mode 100644 index 00000000..9df68584 --- /dev/null +++ b/endpoint_jsonifier/i18n/it.po @@ -0,0 +1,48 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * endpoint_jsonifier +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 14.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2025-01-20 11:06+0000\n" +"Last-Translator: mymage \n" +"Language-Team: none\n" +"Language: it\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 5.6.2\n" + +#. module: endpoint_jsonifier +#: model:ir.model.fields,field_description:endpoint_jsonifier.field_endpoint_mixin__display_name +msgid "Display Name" +msgstr "Nome visualizzato" + +#. module: endpoint_jsonifier +#: model:ir.model,name:endpoint_jsonifier.model_endpoint_mixin +msgid "Endpoint mixin" +msgstr "Mixin endpoint" + +#. module: endpoint_jsonifier +#: model_terms:ir.ui.view,arch_db:endpoint_jsonifier.endpoint_mixin_form_view +msgid "Export" +msgstr "Esporta" + +#. module: endpoint_jsonifier +#: model:ir.model.fields,field_description:endpoint_jsonifier.field_endpoint_endpoint__exporter_id +#: model:ir.model.fields,field_description:endpoint_jsonifier.field_endpoint_mixin__exporter_id +msgid "Exporter" +msgstr "Esportatore" + +#. module: endpoint_jsonifier +#: model:ir.model.fields,field_description:endpoint_jsonifier.field_endpoint_mixin__id +msgid "ID" +msgstr "ID" + +#. module: endpoint_jsonifier +#: model:ir.model.fields,field_description:endpoint_jsonifier.field_endpoint_mixin____last_update +msgid "Last Modified on" +msgstr "Ultima modifica il" diff --git a/endpoint_jsonifier/models/__init__.py b/endpoint_jsonifier/models/__init__.py new file mode 100644 index 00000000..95c62dfe --- /dev/null +++ b/endpoint_jsonifier/models/__init__.py @@ -0,0 +1 @@ +from . import endpoint_mixin diff --git a/endpoint_jsonifier/models/endpoint_mixin.py b/endpoint_jsonifier/models/endpoint_mixin.py new file mode 100644 index 00000000..7a5ada37 --- /dev/null +++ b/endpoint_jsonifier/models/endpoint_mixin.py @@ -0,0 +1,10 @@ +# Copyright 2024 Camptocamp SA +# License AGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). + +from odoo import fields, models + + +class EndpointMixin(models.AbstractModel): + _inherit = "endpoint.mixin" + + exporter_id = fields.Many2one("ir.exports") diff --git a/endpoint_jsonifier/pyproject.toml b/endpoint_jsonifier/pyproject.toml new file mode 100644 index 00000000..4231d0cc --- /dev/null +++ b/endpoint_jsonifier/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["whool"] +build-backend = "whool.buildapi" diff --git a/endpoint_jsonifier/readme/CONTRIBUTORS.md b/endpoint_jsonifier/readme/CONTRIBUTORS.md new file mode 100644 index 00000000..804e6767 --- /dev/null +++ b/endpoint_jsonifier/readme/CONTRIBUTORS.md @@ -0,0 +1,2 @@ +- [Camptocamp SA](https://camptocamp.com): + - Silvio Gregorini \<\> diff --git a/endpoint_jsonifier/readme/DESCRIPTION.md b/endpoint_jsonifier/readme/DESCRIPTION.md new file mode 100644 index 00000000..6b42345e --- /dev/null +++ b/endpoint_jsonifier/readme/DESCRIPTION.md @@ -0,0 +1,2 @@ +This addon allows configuring an exporter for endpoints to be used in +code snippets. diff --git a/endpoint_jsonifier/readme/USAGE.md b/endpoint_jsonifier/readme/USAGE.md new file mode 100644 index 00000000..b9c3a325 --- /dev/null +++ b/endpoint_jsonifier/readme/USAGE.md @@ -0,0 +1,12 @@ +This module by itself contains no business logic, but its configuration +can be used to manage endpoints' data export. + +For example: + +``` python +parser = endpoint.export_id.get_json_parser() +prod_domain = [("sale_ok", "=", True)] +prod_data = env["product.product"].search(prod_domain).jsonify(parser) +resp = Response(json.dumps(prod_data), content_type="application/json", status=200) +result = dict(response=resp) +``` diff --git a/endpoint_jsonifier/static/description/icon.png b/endpoint_jsonifier/static/description/icon.png new file mode 100644 index 00000000..3a0328b5 Binary files /dev/null and b/endpoint_jsonifier/static/description/icon.png differ diff --git a/endpoint_jsonifier/static/description/index.html b/endpoint_jsonifier/static/description/index.html new file mode 100644 index 00000000..8c9458f6 --- /dev/null +++ b/endpoint_jsonifier/static/description/index.html @@ -0,0 +1,443 @@ + + + + + +Endpoint JSONifier + + + +
+

Endpoint JSONifier

+ + +

Beta License: LGPL-3 OCA/web-api Translate me on Weblate Try me on Runboat

+

This addon allows configuring an exporter for endpoints to be used in +code snippets.

+

Table of contents

+ +
+

Usage

+

This module by itself contains no business logic, but its configuration +can be used to manage endpoints’ data export.

+

For example:

+
+parser = endpoint.export_id.get_json_parser()
+prod_domain = [("sale_ok", "=", True)]
+prod_data = env["product.product"].search(prod_domain).jsonify(parser)
+resp = Response(json.dumps(prod_data), content_type="application/json", status=200)
+result = dict(response=resp)
+
+
+
+

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 to smash it by providing a detailed and welcomed +feedback.

+

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

+
+
+

Credits

+
+

Authors

+
    +
  • Camptocamp
  • +
+
+ +
+

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.

+

Current maintainers:

+

SilvioC2C simahawk

+

This module is part of the OCA/web-api project on GitHub.

+

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

+
+
+
+ + diff --git a/endpoint_jsonifier/views/endpoint_endpoint.xml b/endpoint_jsonifier/views/endpoint_endpoint.xml new file mode 100644 index 00000000..7168aaa5 --- /dev/null +++ b/endpoint_jsonifier/views/endpoint_endpoint.xml @@ -0,0 +1,18 @@ + + + + endpoint.endpoint + + + + + + + + + + + + + +