Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
3 Trả lời
8699 Lượt xem

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 

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

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


Ảnh đại diện
Huỷ bỏ
Tác giả Câu trả lời hay nhất

Hi Ahmed,

I tried your line but it did not work

Thnaks

Ảnh đại diện
Huỷ bỏ

can you post your code ?

Câu trả lời hay nhất

Hello,

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

Regards,

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 3 15
3520
naked domain set up Đã xử lý
3
thg 7 25
4504
1
thg 5 25
1063
0
thg 5 25
962
2
thg 11 24
2237