Hide ir.action.keyword depending on State

Hello,

How do I set this print report to invisible depending on its state?

image

    <record model="ir.action.keyword" id="keyword_purchase_requisition">
        <field name="keyword">form_print</field>
        <field name="model">purchase.requisition,-1</field>
        <field name="action" ref="report_purchase_requisition"/>
    </record>

Best regards

AFAIK it’s not doable. An alternative is to override a report class function (like the execute one) to check the state and show a warning to the user in order to prevent the print. Anyway, I am not sure if it is a good practice, maybe someone else can confirm which is the best way to achieve it.

Indeed the alternative is to use a button action with a states (and to add the button to the views form and list).

You are right, this solution fits better with the Tryton framework, however it can create confusión for the user who expects to find the report always in the same place.

I do not think there is a valid use case for a conditional report. A report is just displaying record on a printable format (just like there is not conditional usage of a form view).

Thank you for your kind suggestion.

It was because our user gave a feedback that it was an eyesore.