Odoo Help


This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


How to make a button print with two choices in odoo

Drees Far
on 1/18/16, 2:29 PM 455 views


please, i have realised two reports. but now i want a button print but when i click on it i will get the choice between the two reports.

Can anyone help please.

thanks a lot in advance


Ankit H Gandhi(AHG)

--Ankit H Gandhi(AHG)--
| 5 3 6
Gandhinagar, India
--Ankit H Gandhi(AHG)--

Learning Python..

Ankit H Gandhi(AHG)
On 1/19/16, 6:44 AM

Dear Drees Far,

Good question,

As per your requirement create one new separate selection field which have two value related to report name and also you can apply radio widget in selection field for choices.

Also you need to create two button for reports.

Now using attrs you can do visible or invisible button as per selection field value.

Hope this suggestion help for you.

Updated code:

Step-1: Need to create one new selection field in py file

report_list = [('report1', 'Report1'), ('report2', 'Report2')]

columns = {

     'report_choice': fields.selection(report_list, 'Reports Choices')

Step-2: Define selection field in xml file.

<field name="report_choice" widget="radio"/>

<button name="your method-1" type="object" string="Report1" attrs="{'invisible':['|',('report','=', False), ('report', '=', 'report2')]}"/>

<button name="your method-2" type="object" string="Report2" attrs="{'invisible':['|',('report','=', False), ('report', '=', 'report1')]}"/>

Hope this code help for you

Best Regards,

Ankit H Gandhi.


Ankit thanks a lot for your answer but my friend would you please give me an example of code to be more specific please :)

Drees Far
on 1/19/16, 7:11 AM

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)


Asked: 1/18/16, 2:29 PM
Seen: 455 times
Last updated: 1/19/16, 6:44 AM