[FIX] evaluation context structures not being round-tripped through eval
authorXavier Morel <xmo@openerp.com>
Mon, 24 Jun 2013 05:59:29 +0000 (07:59 +0200)
committerXavier Morel <xmo@openerp.com>
Mon, 24 Jun 2013 05:59:29 +0000 (07:59 +0200)
commit11a0ece5438d551963b5c9cdbb95720b0e91d98d
tree5eaead53f66ace0df368eee27414ee7f5d6911ae
parente2c795e29764c1b65b3cf34ce3120e17a0fe399f
[FIX] evaluation context structures not being round-tripped through eval

JS objects are converted to py.object when passed in through the
evaluation context. py.object are not serializable by default (because
that doesn't really make sense), which breaks when the input is
intended as a dict and returned (e.g. o2m values, which are triples of
(int, int?, dict?)).

Intuitively, JS objects passed as part of the context should be mostly
JSON-ish and thus dicts, but that turns out not work work as some
addons use attribute accesses within contexts (e.g. parent.access in
account/account_invoice_view.xml)

=> Temporarily solve by converting raw js objects to an "attributed
dict" which acts as both a dict and an object and can be converted to
JSON.

Ideally, py.js should provide for a pluggable conversion, or should
use an attributed mapping internally. See issues 21 and 23.

lp bug: https://launchpad.net/bugs/1182101 fixed

bzr revid: xmo@openerp.com-20130624055929-3rtkgqrp4o87pvau
addons/web/static/src/js/pyeval.js
addons/web/static/test/evals.js