跳至内容
菜单
此问题已终结
3 回复
22474 查看

Hey all how can we call a report action from a method of that particular object.......

for now we can call a report action from a button ( type is action ) but i want from button but (type is object )

thats i want

Thanks

形象
丢弃
最佳答案

Your button function should return a dictionary with having type as 'ir.actions.report.xml' report_name as the name of the report and datas as the data of the current record. Following is an example

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,
            }
形象
丢弃
编写者

great answer....:):)

最佳答案

I can't make it work on Odoo 8. 

I can write on a record, but I was unable to replicate with automated actions the button press to automatically create a pos order report. Could you gently help me Omal? 

形象
丢弃