forked from OCA/server-tools
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1341 from OCA/14.0
Syncing from upstream OCA/server-tools (14.0)
- Loading branch information
Showing
7 changed files
with
173 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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}]}] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.