Commit Graph

23 Commits (09aff57cd03b7d43b84bc5c096977ebe5049459d)

Author SHA1 Message Date
nans 09aff57cd0 [IMP] base_jsonify: simplify full parser API when not using translations 2023-02-27 10:05:54 +01:00
nans 8380df640e [IMP] base_jsonify: add lang, custom resolvers, alias* support 2023-02-27 10:05:54 +01:00
Laurent Mignon (ACSONE) c54627cca5 [IMP] base_jsonify: Allow to export many2one and referene field as simple field
Before this change, the result of the export of a relational field was always a dict or a list of dict.

ex:

<record id="ir_exp_shopinvader_variant_lang" model="ir.exports.line">
  <field name="name">publication_language_id/name</field>
  <field name="alias">publication_language_id/name:lang</field>
  <field name="export_id" ref="shopinvader.ir_exp_shopinvader_variant" />
</record>

will output:
{
    ...
    "publication_language_id" : {
        "lang": "French"
    }
    ...
}

After this change it's now possible to define simple exporter for relational fields where the value into the result will be the display_name or a list of display_name of the related records.

ex:

<record id="ir_exp_shopinvader_variant_lang" model="ir.exports.line">
  <field name="name">publication_language_id</field>
  <field name="alias">publication_language_id:lang</field>
  <field name="export_id" ref="shopinvader.ir_exp_shopinvader_variant" />
</record>

will output:
{
    "lang": "French"
}
 Please enter the commit message for your changes. Lines starting
2023-02-27 10:05:54 +01:00
Simone Orsi 2b46ff032c base_jsonify: return one record on demand
If you use this module extensively - as I do -
you've done this tons of time. For sure :)
This little change simplifies your code base where needed.
2023-02-27 10:05:54 +01:00
Simone Orsi e2e9bee9dc base_jsonify: support callable parser 2023-02-27 10:05:54 +01:00
Simone Orsi f947336f62 base_jsonify: ease override jsonify per record 2023-02-27 10:05:54 +01:00
Laurent Mignon (ACSONE) 1cd1c11562 [FIX] base_jsonify: Serialize datetime into the user's timezone 2023-02-27 10:05:54 +01:00
Laurent Mignon (ACSONE) e629cac52f [FIX] base_jsonify: Add tz info into serialized datetime 2023-02-27 10:05:54 +01:00
Laurent Mignon (ACSONE) 4a95e38d9d [IMP] base_jsonify: Serialize Date and Datetime into ISO 8601 format 2023-02-27 10:05:54 +01:00
Laurent Mignon (ACSONE) b08a2dfaf3 [FIX] base_jsonify: In odoo 12, Date and Datetime fields values are datetime object
Convert fields.Date and fields.Datetime values to string when serializing to json
2023-02-27 10:05:54 +01:00
Laurent-Corron 96e3ad7459 [MIG] base_jsonify: Migration to 13.0 2023-02-27 10:05:54 +01:00
laurent.corron b92f8d5244 [IMP] base_jsonify: black, isort 2023-02-27 10:05:54 +01:00
Simone Orsi fa9db3d975 [12.0][MIG] base_jsonify: cleanup 2023-02-27 10:05:54 +01:00
Simone Orsi 172243a7fe [12.0][MIG] base_jsonify: py3 2023-02-27 10:05:54 +01:00
Pierrick brun ec8473059a base_jsonify: misc fixes on comments/docstrings 2023-02-27 10:05:54 +01:00
beau sebastien a633bcf6e9 base_jsonify: restore travis configuration (#112)
* [ADD] restore travis configuration

* [PEP] fix pep8

* [REF] exclude  product_categ_available_pos of testing due to issue https://github.com/odoo/odoo/pull/23749
2023-02-27 10:05:54 +01:00
Laurent Mignon (ACSONE) 52d508ed9b base_jsonify: Output 'false' into json only for boolean fields 2023-02-27 10:05:54 +01:00
hpar 36d8adea96 base_jsonify: cleanups
remove copyrights from init and update copyrights
2023-02-27 10:05:54 +01:00
Sébastien BEAU bc2565e117 base_jsonify: remove False for int, float, string 2023-02-27 10:05:54 +01:00
Sébastien BEAU 9d9d8bfdc8 base_jsonify: add support of reference fields 2023-02-27 10:05:54 +01:00
Laurent Mignon (ACSONE) a149deff5f base_jsonify: typo 2023-02-27 10:05:54 +01:00
Laurent Mignon (ACSONE) 8941042826 base_jsonify: Allow fields aliasing in jsonify 2023-02-27 10:05:54 +01:00
Sébastien BEAU 9af356504f add base_jsonify module 2023-02-27 10:05:54 +01:00