简体   繁体   English

如何根据条件隐藏按钮? odoo 11

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

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')]}"/>

您可以添加样式,将display: none添加到按钮以隐藏它

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')]}"/>  

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM