Hello, I have Odoo 8. I developed a wizard, and I want to launch a qweb report (which I have developed in a xml file and works fine) when the user press "OK" button in the wizard. How can I launch the report from the Python method for "OK"?
Thanks!
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
Hello, I have Odoo 8. I developed a wizard, and I want to launch a qweb report (which I have developed in a xml file and works fine) when the user press "OK" button in the wizard. How can I launch the report from the Python method for "OK"?
Thanks!
for new api
@api.multi
def invoice_print(self):
""" Print the invoice and mark it as sent, so that we can see more
easily the next step of the workflow
"""
assert len(self) == 1, 'This option should only be used for a single id at a time.'
self.sent = True
return self.env['report'].get_action(self, 'account.report_invoice')
for old api
def print_quotation(self, cr, uid, ids, context=None):
'''
This function prints the sales order and mark it as sent, so that we can see more easily the next step of the workflow
'''
assert len(ids) == 1, 'This option should only be used for a single id at a time'
self.signal_workflow(cr, uid, ids, 'quotation_sent')
return self.pool['report'].get_action(cr, uid, ids, 'sale.report_saleorder', context=context)
Hello Jose,
Try below method on click of Wizard button.
@api.multi
def print_report(self):
report_obj = self.env['model.name'].search([]).ids
datas = {
'ids': report_obj,
'model': 'model.name',
'form': report_obj,
}
return {
'type': 'ir.actions.report.xml',
'report_name': 'module_name.report_id',
'datas': datas,
}
Hope it works for you.
Thanks,
Tạo tài khoản ngay hôm nay để tận hưởng các tính năng độc đáo và tham gia cộng đồng tuyệt vời của chúng tôi!
Đăng kýBài viết liên quan | Trả lời | Lượt xem | Hoạt động | |
---|---|---|---|---|
|
2
thg 5 15
|
7731 | ||
|
7
thg 5 20
|
6274 | ||
|
4
thg 10 16
|
6566 | ||
|
0
thg 4 16
|
2967 | ||
|
2
thg 4 15
|
5816 |