Skip to Content
Menu
This question has been flagged
2 Replies
9240 Views

How can I adapt the following code for odoo17

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

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

Avatar
Discard
Best Answer

Hi 

Try the following 


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

2 ) invisible ="not user_id" 



Regards


Avatar
Discard
Author

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

Author

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'"

Author

Hi,
What about states
states='draft

Author

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

invisible="not sheet_ids"

Author

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"

Author

Can anyone help me to solve the above codes?

Author

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

Best Answer

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
Discard