Skip ke Konten
Menu
Pertanyaan ini telah diberikan tanda
2 Replies
9335 Tampilan

How can I adapt the following code for odoo17

1) attrs="{'invisible': [('identification_id', 'in', [None,False])]}"/>

2) attrs="{'invisible': [('user_id', '=', False)]}"

Avatar
Buang
Jawaban Terbai

Hi 

Try the following 


1 ) invisible ="identification_id in [None,False]"

2 ) invisible ="not user_id" 



Regards


Avatar
Buang
Penulis

Hi Mily,
What might be the below one:
attrs="{'invisible': [('has_badges', '=', True)]}"

Penulis

Hi,
How should I change this one
attrs="{'readonly': ['|',('read_only','=',False),('state','=','approved')]}"

try this , invisible="has_badges", readonly="read_only == False or state == 'approved'"

Penulis

Hi,
What about states
states='draft

Penulis

What might this one
attrs="{'invisible': [('sheet_ids', '=', [])]}"

invisible="not sheet_ids"

Penulis

Can you help me to find all of it.

1) attrs="{'invisible': ['|', ('attachment_number', '<=', 0), ('sheet_id', '!=', False)]}"
2) attrs="{'invisible': [('attachment_number', '>=', 1)]}"
3) attrs="{'invisible': [('same_currency', '=', True), ('product_has_cost', '=', False)]}"
4) attrs="{'invisible': ['|', ('accounting_date', '=', False), ('state', 'not in', ['approved', 'done'])]}"
5) attrs="{'invisible': ['|', ('payment_state', 'in', ('paid', 'in_payment')), ('state', 'not in', ('post', 'done'))]}"
6) attrs="{'invisible': ['|', ('can_reset', '=', False), ('state', 'not in', ['submit', 'cancel', 'approve'])]}"
7) attrs="{'invisible': ['|', ('state', 'not in', ['post', 'done']), ('account_move_id', '=', False)]}"
8) attrs="{'invisible': ['|', ('payment_mode', '=', 'own_account'), ('payment_state', 'not in', ['paid', 'in_payment', 'partial'])]}"
9) attrs="{'invisible': [('state', 'not in', ['approve', 'post', 'done'])], 'readonly': [('state', 'in', ['post', 'done'])]}"/>
10) attrs="{'invisible': [('state', 'not in', ('post', 'done'))]}"
11) states="submit,approve"

Penulis

Can anyone help me to solve the above codes?

Penulis

I just only want the code for 1,2 and 3.
Can anyone help me on it.

Jawaban Terbai

For anyone stilll looking for answers use:

From:

1) attrs="{'invisible': [('identification_id', 'in', [None,False])]}"/>

To

invisible="[('identification_id', 'in', [None, False])]"

According to the Odoo 17 docs, the brackets syntax still works, but one needs to use the attribute name instead of declaring it as an object in attrs.

Tested it and it worked.

Avatar
Buang