Community mailing list archives

community@mail.odoo.com

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

by
Skillteam, Houssine BAKKALI
- 08/07/2015 13:47:19

You're welcome thanks for your feedback ;)

Le 7 août 2015 13:42, "Nuria Arranz Velazquez" <nuria@opusvl.com> a écrit :
Hi Houssine,

Just so you know, we gave it a good go, and the only trouble we encountered was old api versus new api differences. So in the end the method looks a bit different, but it is the same principle.

Thank you very much for all your help :-)

Nuria

On 07/08/15 10:14, Nuria Arranz Velazquez wrote:
<blockquote cite="mid:55C476F4.10208@opusvl.com" type="cite">
I gathered that much lol :-) I'm not a programmer anymore (haven't been for many years now) so I'll ask my team to give me a hand with it.

Again, thank you very much for your help :-)

On 06/08/15 19:47, Houssine BAKKALI wrote:
<blockquote cite="mid:CANNbhR-wvXboiicWLt1BLSfjTMEP8+YagZTHVtNxm8J33hsxVA@mail.gmail.com" type="cite">
You're a welcome!!

please note that you still need to override the print_invoice function to add the filter on the flag default of the ir.actions.report.xml. something like the following code snippet.

same goes for purchase and sale order

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'),('default','=',True])
        return self.env['report'].get_action(self, report_obj.report_name)

2015-08-06 15:47 GMT+02:00 Nuria Arranz Velazquez <nuria@opusvl.com>:
Many thanks, Houssine!

I'll test it as soon as I can :-)

On 05/08/15 23:33, Houssine BAKKALI wrote:
<blockquote cite="mid:CANNbhR_FWfSEsSzXeXLC+zZHWXC1NLrNT8FZKFFtv1wcAFRu_Q@mail.gmail.com" type="cite">
Hi Nuria,

You will find the module following this link

2015-08-05 11:40 GMT+02:00 Nuria Arranz Velazquez <nuria@opusvl.com>:
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

_______________________________________________
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


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