跳至内容
菜单
此问题已终结
3495 查看

I am trying to generate a report, the only thing I know about the following code is that the function which calls the "report generator" has to return the type 'ir.actions.report.xml'. Then, I tried to change the value of report_name, which I thought it was possible, but it gives me an error if I change its name. And I do not have any idea of which content has to have the dictionary datas, the only variable I see that is repeating in every code I check is model.

Anyone could explain me this a bit to understand it better or recommend me a tutorial (not the official one)?. I am a newbie on this, I would appreciate any help.

def check_report(self, cr, uid, ids, context=None):
    if context is None:
        context = {}
    data = self.read(cr, uid, ids)[0]
    datas = {
        'ids': context.get('active_ids', []),
        'model': 'account.analytic.account',
        'form': data
    }
    return {
        'type': 'ir.actions.report.xml',
        'report_name': 'account.analytic.account.balance',
        'datas': datas,
    }

形象
丢弃
相关帖文 回复 查看 活动
0
10月 24
1775
0
8月 24
1594
0
1月 24
2089
1
11月 23
1794
0
6月 23
2153