mirror of
https://github.com/bringout/oca-technical.git
synced 2026-04-18 14:52:01 +02:00
Initial commit: OCA Technical packages (595 packages)
This commit is contained in:
commit
2cc02aac6e
24950 changed files with 2318079 additions and 0 deletions
|
|
@ -0,0 +1,28 @@
|
|||
with_fieldname parameter
|
||||
==========================
|
||||
|
||||
The with_fieldname option of jsonify() method, when true, will inject on
|
||||
the same level of the data "_fieldname_$field" keys that will
|
||||
contain the field name, in the language of the current user.
|
||||
|
||||
|
||||
Examples of with_fieldname usage:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
# example 1
|
||||
parser = [('name')]
|
||||
a.jsonify(parser=parser)
|
||||
[{'name': 'SO3996'}]
|
||||
>>> a.jsonify(parser=parser, with_fieldname=False)
|
||||
[{'name': 'SO3996'}]
|
||||
>>> a.jsonify(parser=parser, with_fieldname=True)
|
||||
[{'fieldname_name': 'Order Reference', 'name': 'SO3996'}}]
|
||||
|
||||
|
||||
# example 2 - with a subparser-
|
||||
parser=['name', 'create_date', ('order_line', ['id' , 'product_uom', 'is_expense'])]
|
||||
>>> a.jsonify(parser=parser, with_fieldname=False)
|
||||
[{'name': 'SO3996', 'create_date': '2015-06-02T12:18:26.279909+00:00', 'order_line': [{'id': 16649, 'product_uom': 'stuks', 'is_expense': False}, {'id': 16651, 'product_uom': 'stuks', 'is_expense': False}, {'id': 16650, 'product_uom': 'stuks', 'is_expense': False}]}]
|
||||
>>> a.jsonify(parser=parser, with_fieldname=True)
|
||||
[{'fieldname_name': 'Order Reference', 'name': 'SO3996', 'fieldname_create_date': 'Creation Date', 'create_date': '2015-06-02T12:18:26.279909+00:00', 'fieldname_order_line': 'Order Lines', 'order_line': [{'fieldname_id': 'ID', 'id': 16649, 'fieldname_product_uom': 'Unit of Measure', 'product_uom': 'stuks', 'fieldname_is_expense': 'Is expense', 'is_expense': False}]}]
|
||||
Loading…
Add table
Add a link
Reference in a new issue