Community mailing list archives

community@mail.odoo.com

Re: Making a new report print by default when pressing the print button

by
OpusVL, Nuria Arranz-Velazquez
- 08/05/2015 05:27:05
That would be absolutely brilliant, yes please, share :-)

Many thanks in advance,
Nuria

On 03/08/15 22:35, Houssine BAKKALI wrote:
<blockquote cite="mid:CANNbhR92O4hiCfVSpqoCOy86vqykwqr2naeoL_Z+YxZYQD+0=g@mail.gmail.com" type="cite">
Hi Nuria,

You should override the invoice_print function somethin like the following :

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.'

        report_obj = self.env['ir.actions.report.xml'].search([('model', '=', 'account.invoice')])
        return self.env['report'].get_action(self, report_obj.report_name)

it won't work if you have several report for the same model. you will need to implement a default report. I've done such module and I can share it after some cleaning if needed.

2015-08-03 13:59 GMT+02:00 Nuria Arranz Velazquez <nuria@opusvl.com>:
Hi Humberto,

I'm sorry I didn't understand your answer.

:-/

On 18/07/15 02:06, Humberto Arocha wrote:
<blockquote cite="mid:CAH-dr4AMY-X8eMabQsu7Q9j6RTCVKj1sMURStoAmhFREHhBB-Q@mail.gmail.com" type="cite">

Use the button id  of the button you want to override as the id a new button you want to use as your report

On Jul 17, 2015 9:53 AM, "Nuria Arranz Velazquez" <nuria@opusvl.com> wrote:

Hi all,

I didn't want to highjack a thread already going on about new reports with my question, so I'm starting a new thread.

Suppose I followed these instructions successfully:

http://odoo.guide/report-design-workshop/

Now I have my new report showing in the printing drop down.

But the Print button at the top left of the screen is set to use the default (old) print layout that is not good to me: I want to print my new layout by default.

How do I do it?

Many thanks in advance,
Nuria

-- 
N. Arranz-Velazquez
OpusVL Odoo Specialist Team (OOST)
Product Owner

OpusVL
Drury House
Drury Lane
Rugby
CV21 3DE

T: 01788 298 450
W: www.opusvl.com

_______________________________________________
Mailing-List: https://www.odoo.com/groups/community-59
Post to: mailto:community@mail.odoo.com
Unsubscribe: https://www.odoo.com/groups?unsubscribe

_______________________________________________
Mailing-List: https://www.odoo.com/groups/community-59
Post to: mailto:community@mail.odoo.com
Unsubscribe: https://www.odoo.com/groups?unsubscribe



-- 
N. Arranz-Velazquez
OpusVL Odoo Specialist Team (OOST)
Product Owner

OpusVL
Drury House
Drury Lane
Rugby
CV21 3DE

T: 01788 298 450
W: www.opusvl.com

_______________________________________________
Mailing-List: https://www.odoo.com/groups/community-59
Post to: mailto:community@mail.odoo.com
Unsubscribe: https://www.odoo.com/groups?unsubscribe


_______________________________________________
Mailing-List: https://www.odoo.com/groups/community-59
Post to: mailto:community@mail.odoo.com
Unsubscribe: https://www.odoo.com/groups?unsubscribe



-- 
N. Arranz-Velazquez
OpusVL Odoo Specialist Team (OOST)
Product Owner

OpusVL
Drury House
Drury Lane
Rugby
CV21 3DE

T: 01788 298 450
W: www.opusvl.com