You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

116 lines
2.9 KiB

  1. .. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg
  2. :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
  3. :alt: License: AGPL-3
  4. ==============
  5. Base Jsonify
  6. ==============
  7. This module add the jsonify method to the ORM. This method take as argument
  8. the browse record and the "parser" that specify the field to extract.
  9. Example of parser:
  10. .. code-block:: python
  11. parser = [
  12. 'name',
  13. 'number',
  14. 'create_date',
  15. ('partner_id', ['id', 'display_name', 'ref'])
  16. ('line_id', ['id', ('product_id', ['name']), 'price_unit'])
  17. ]
  18. In order to be consitent with the odoo api the jsonify method always
  19. return a list of object even if there is only one element in input
  20. By default the key into the json is the name of the field extracted
  21. from the model. If you need to specify an alternate name to use as key, you
  22. can define your mapping as follow into the parser definition:
  23. .. code-block:: python
  24. parser = [
  25. 'field_name:json_key'
  26. ]
  27. .. code-block:: python
  28. parser = [
  29. 'name',
  30. 'number',
  31. 'create_date:creationDate',
  32. ('partner_id:partners', ['id', 'display_name', 'ref'])
  33. ('line_id:lines', ['id', ('product_id', ['name']), 'price_unit'])
  34. ]
  35. Also the module provide a method "get_json_parser" on the ir.exports object
  36. that generate a parser from an ir.exports configuration
  37. Installation
  38. ============
  39. To install this module, you need to install it
  40. Configuration
  41. =============
  42. No configuration required
  43. Usage
  44. =====
  45. This is a technical module not function feature is added
  46. .. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
  47. :alt: Try me on Runbot
  48. :target: https://runbot.odoo-community.org/runbot/{repo_id}/{branch}
  49. .. repo_id is available in https://github.com/OCA/maintainer-tools/blob/master/tools/repos_with_ids.txt
  50. .. branch is "8.0" for example
  51. Known issues / Roadmap
  52. ======================
  53. Nothing yet
  54. Bug Tracker
  55. ===========
  56. Bugs are tracked on `GitHub Issues
  57. <https://github.com/OCA/{project_repo}/issues>`_. In case of trouble, please
  58. check there if your issue has already been reported. If you spotted it first,
  59. help us smashing it by providing a detailed and welcomed feedback.
  60. Credits
  61. =======
  62. Images
  63. ------
  64. * Odoo Community Association: `Icon <https://github.com/OCA/maintainer-tools/blob/master/template/module/static/description/icon.svg>`_.
  65. Contributors
  66. ------------
  67. * BEAU Sébastien <sebastien.beau@akretion.com>
  68. * Laurent Mignon <laurent.mignon@acsone.eu>
  69. Maintainer
  70. ----------
  71. .. image:: https://odoo-community.org/logo.png
  72. :alt: Odoo Community Association
  73. :target: https://odoo-community.org
  74. This module is maintained by the OCA.
  75. OCA, or the Odoo Community Association, is a nonprofit organization whose
  76. mission is to support the collaborative development of Odoo features and
  77. promote its widespread use.
  78. To contribute to this module, please visit https://odoo-community.org.