Community mailing list archives

community@mail.odoo.com

Re: AW: 404 when getting CSS for qweb report

by
Camptocamp France SAS, Alexandre Fayolle - Camptocamp
- 05/06/2016 03:39:14
On 05/05/2016 16:22, Pedro Manuel Baeza Romero wrote:
> Have you tried adding the key 'target' with the value 'current' to the
> dictionary returned by get_action?


Hi Pedro,

Do you mean something like:

    @api.multi
    def confirm(self):
        self.ensure_one()
        to_print = self.holdback_payment_ids.mapped('holdback_payment_id')
        to_print.action_done()
        action = self.env['report'].get_action(
            self.purchase_id,
            'outsourcing.holdback_payment_report_template',
        )
        action['target'] = 'current'
        return action


I had not tried, but the wizard stays open.

Current workaround I'll have to sell to my end users is:

    @api.multi
    def confirm(self):
        self.ensure_one()
        to_print = self.holdback_payment_ids.mapped('holdback_payment_id')
        to_print.action_done()
        self.env['report'].get_pdf(
            self.purchase_id,
            'outsourcing.holdback_payment_report_template'
        )
        return False

This closes the wizard and the report is available as attachment on
self.purchase_id which is displayed when the wizard is closed... Not
ideal...



-- 
Alexandre Fayolle
Chef de Projet
Tel : +33 4 58 48 20 30

Camptocamp France SAS
Savoie Technolac, BP 352
73377 Le Bourget du Lac Cedex
http://www.camptocamp.com