Search code examples
odoo-8odooodoo-view

View or hide one report menu based on condition in odoo 8


I am new in odoo. I am using Odoo 8. It is under stock/stock_report.xml. I inherit one menu option (top dropdown menu) report in my new module. Now I want to show it based on some condition. More clearly, menu="False" if ('state', '==', 'assigned') otherwise, menu="True".

How can I write this in menu. I have tried like following way. But it does not work. Or, if there any other way to do. I must have to do it by inheriting.

<report
            string="Picking test"
            id="stock.action_report_picking"
            model="stock.picking"
            report_type="qweb-pdf"
            name="stock.report_picking"
            file="stock.report_picking"
            menu="{'False':['|',('state', '==', 'assigned')]}"
        />

Solution

  • You cannot do that but you can work a round hide that report from the menu

       menu = "False"
    

    And use a button to print that report with button you can use attrs to hide that button [('state', '=', 'assigned')]