I have a report created in rml and I want to call it from a button nor than print option
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Kế toán
- Tồn kho
- PoS
- Project
- MRP
Câu hỏi này đã bị gắn cờ
Hello,
you can return the following values on the click of button. It will print the report.
return {
'type': 'ir.actions.report.xml',
'report_name': '<name.of.your.report>',
'datas':< { data : which you want to use in the report } >,
}
You can find this kind of ex. in the account module.
In odoo V8 you can use as like below.
def _print_report(self, cr, uid, ids, data, context=None):
if context is None:
context = {}
data['form'].update(self.read(cr, uid, ids, ['initial_balance', 'amount_currency'])[0])
return self.pool['report'].get_action(cr, uid, [], 'account.report_partnerledger', data=data, context=context)
Expected:} at the end of } !!
Just have a look on the following it is simple example into account module. def _print_report(self, cr, uid, ids, data, context=None): if context is None: context = {} data['form'].update(self.read(cr, uid, ids, ['display_partner'])[0]) return { 'type': 'ir.actions.report.xml', 'report_name': 'account.partner.balance', 'datas': data, } It is working well.
in Odoo v8.0 doesn't work !
I have update my answer please have a look. Thanks.
I get this error: SyntaxError: JSON.parse: unexpected end of data at line 2 column 1 of the JSON data http://localhost:9090/web/js/web.assets_backend/33b98d6:2890
can you put your entire code in the Q ? It is easy to fix it.
voilà=== def print_rml(self, cr, uid, ids, data, context=None): if context is None: context = {} return self.pool['report'].get_action(cr, uid, [], 'sale_comarev.report_rml', context=context)
Bạn có hứng thú với cuộc thảo luận không? Đừng chỉ đọc, hãy tham gia nhé!
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 | |
---|---|---|---|---|
how to trace errors like this ?
Đã xử lý
|
|
6
thg 12 16
|
11566 | |
|
1
thg 3 15
|
6634 | ||
|
0
thg 3 15
|
3157 | ||
|
1
thg 3 15
|
3517 | ||
|
0
thg 3 15
|
3810 |