This question has been flagged
3 Replies
20862 Views

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

Avatar
Discard
Best Answer

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,
            }
Avatar
Discard
Author

great answer....:):)

Best 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? 

Avatar
Discard