【问题标题】:Odoo Report from controller来自控制器的 Odoo 报告
【发布时间】:2016-03-11 17:37:46
【问题描述】:

我有一个要求必须从控制器返回报告。

我拥有调用报告获取操作方法所需的所有必要数据。但是从控制器它不起作用。

我怎样才能做到这一点?

代码如下:

datas = calreport_orm.print_report(cr, uid, [calreport_obj_id], context)
return request.registry.get('report').get_action(cr, uid, [], 'docmarolf_calendar.report_calendar_meeting', data=datas, context=context)

【问题讨论】:

  • 您是否尝试过以下答案?

标签: report openerp openerp-7 openerp-8 qweb


【解决方案1】:

首先,我们必须映射/读取要在报告中显示的对象的记录。

我们可以这样实现:

if context is None:
    context = {}

ids = [calreport_obj_id] #id of calling report obj

data = calreport_orm.read(cr, uid, ids)[0] #read data from the record id

datas = {
    'ids': ids,
    'model': 'your.modal.name',
    'form': data
}

return self.pool['report'].get_action(cr, uid, [], 'docmarolf_calendar.report_calendar_meeting', data=datas, context=context)

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-06-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多