1

when I write Orm Query to get all project.project data to pass it to webKit report I get this error :

TypeError: browse_record(project.project, 1) is not JSON serializable

and this my code:

def print_report(self, cr, uid, ids, context=None):
    # assert len(ids) == 1
    project_obj=self.pool.get("project.project")
    project_ids=project_obj.search(cr,uid,[('analytic_account_id','!=',-1)])
    data = project_obj.browse(cr, uid, project_ids)

    return {'type': 'ir.actions.report.xml',
            'report_name': 'taskmng.report',
            'datas': data}
4

1 回答 1

0

问题是您必须传递三件事:ID 列表、对象名称、包含数据的字典。

在你的情况下试试这个:

datas = {
    'ids': project_ids,
    'model': 'project.project',
    'form': {}
}
return {
    'type': 'ir.actions.report.xml',
    'report_name': 'taskmng.report',
    'datas': datas
}
于 2013-05-01T07:20:29.497 回答