how to hide the button based on a condition? odoo 11

一曲冷凌霜 提交于 2020-01-06 06:31:41

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!