I have a field journal_id in the account.payment model, which is a many2one field referring to the account.journal model. I want to hide certain fields when I select 'Banque' in journal_id, but I don't know how to make it work.
This works in Odoo 14.
Create a new field related to journal_id.name
.
journal_name = fields.Char('Journal Name', related="journal_id.name")
Use it in the field domain for invisible attribute.
<field name="journal_name" invisible="1"/>
<field name="your_field" attrs="{'invisible':[('journal_name ','=','Banque')]}" />