Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

Hide a button when a field has an empty string

By
Ababneh
on 2/8/16, 7:41 AM 603 views

I would like to hide a the "Create Invoice" button on the sale order form using the invisible attribute.

However, I want to hide the button, when a specific "Char" field is not empty.

I tried the XML below but it did not work!

<button name="302" position="replace">

    <button name="302" string="Create Invoice" type="action" states="manual" class="oe_highlight" groups="base.group_user" attrs="{'invisible': [('x_original_order_name', '!=', '')]}"/>

</button>

How can I hide the Create Invoice button when my custom field is not empty?

Thanks 

0
Swapnesh
On 2/9/16, 1:46 PM

Hello  Ababneh,


You can not apply "attrs" to button when type is "action"

(you can apply "attrs" when you are opening wizard from button like this)

<button name="%(action_create_payment_order)d" string="Invoices"  type="action" attrs="{'invisible':[('state','=','done')]}" />



Thanks


0
Ababneh
On 2/9/16, 9:57 AM

Hi Ahmed,

I tried your line but it did not work

Thnaks

can you post your code ?

Ahmed M.Elmubarak
on 2/10/16, 1:34 AM
0

Ahmed M.Elmubarak

--Ahmed M.Elmubarak--
2988
| 5 3 5
Sudan
--Ahmed M.Elmubarak--


Ahmed M.Elmubarak
On 2/8/16, 8:13 AM

Hello,

Try to remove the states keyword, and try as e.g: attrs="{'invisible':['|',('x_original_order_name','!=',''),('state','!=', 'manual')]}"

Regards,

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 2/8/16, 7:41 AM
Seen: 603 times
Last updated: 2/9/16, 1:46 PM