问题
I want to hide the "create invoice" button (in quotation view) based on a condition if the command line has a task/service, I tried this code but it does not work :
<button name="%(sale.action_view_sale_advance_payment_inv)d" string="Create Invoice"
type="action" context="{'default_advance_payment_method': 'percentage'}"
attrs="{'invisible': ['|','|', ('task_ids', '=', []), ('invoice_status', '!=', 'no'), ('state', '!=', 'sale')]}"/>
回答1:
You can add a style, display: none to a button to hide it
回答2:
You can write a button like the following:
<button name="%(sale.action_view_sale_advance_payment_inv)d" string="Create Invoice"
type="action" context="{'default_advance_payment_method': 'percentage'}"
attrs="{'invisible': ['|','|', ('task_ids', '=', False), ('invoice_status', '!=', 'no'), ('state', '!=', 'sale')]}"/>
来源:https://stackoverflow.com/questions/55593185/how-to-hide-the-button-based-on-a-condition-odoo-11