test_reports: fix creating objects with o2m/m2m fields.
bzr revid: p_christ@hol.gr-20101221144605-2a9wkz8d25h172uf
This commit is contained in:
parent
08f568ec0f
commit
15893e879d
|
@ -196,6 +196,15 @@ def try_report_action(cr, uid, action_id, active_model=None, active_ids=None,
|
|||
if wiz_data:
|
||||
view_data.update(wiz_data)
|
||||
log.debug("View data is: %r", view_data)
|
||||
|
||||
for fk, field in view_res.get('fields',{}).items():
|
||||
# Default fields returns list of int, while at create()
|
||||
# we need to send a [(6,0,[int,..])]
|
||||
if field['type'] in ('one2many', 'many2many') \
|
||||
and view_data.get(fk, False) \
|
||||
and isinstance(view_data[fk], list) \
|
||||
and not isinstance(view_data[fk][0], tuple) :
|
||||
view_data[fk] = [(6, 0, view_data[fk])]
|
||||
|
||||
action_name = action.get('name')
|
||||
try:
|
||||
|
|
Loading…
Reference in New Issue