From 15893e879d4bae0bd9e9263038131dc404d73c4d Mon Sep 17 00:00:00 2001 From: "P. Christeas" Date: Tue, 21 Dec 2010 16:46:05 +0200 Subject: [PATCH] test_reports: fix creating objects with o2m/m2m fields. bzr revid: p_christ@hol.gr-20101221144605-2a9wkz8d25h172uf --- bin/tools/test_reports.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/bin/tools/test_reports.py b/bin/tools/test_reports.py index 0e5d4189385..931ce74a1ff 100644 --- a/bin/tools/test_reports.py +++ b/bin/tools/test_reports.py @@ -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: