Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
1 ตอบกลับ
3845 มุมมอง

hello

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

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

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

Related Posts ตอบกลับ มุมมอง กิจกรรม
0
ก.ย. 24
1039
0
มี.ค. 18
3271
0
ก.ค. 17
7438
1
พ.ย. 16
2555
How to call report from button (Odoo) แก้ไขแล้ว
1
ต.ค. 15
17226