Skip to Content
Меню
Вам необхідно зареєструватися, щоб взаємодіяти зі спільнотою.
Це запитання позначене
1 Відповісти
5634 Переглядів

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

Аватар
Відмінити
Найкраща відповідь

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)

Related Posts Відповіді Переглядів Дія
6
груд. 16
11328
1
бер. 15
6430
0
бер. 15
2994
1
бер. 15
3311
0
бер. 15
3663