Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
1 Trả lời
5888 Lượt xem

I have a report created in rml and I want to call it from a button nor than print option

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

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)

 

Ảnh đại diện
Huỷ bỏ
Tác giả

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.

Tác giả

in Odoo v8.0 doesn't work !

I have update my answer please have a look. Thanks.

Tác giả

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.

Tác giả

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ài viết liên quan Trả lời Lượt xem Hoạt động
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