In register payment wizard , I added 2 fields. I want to make fields invisibles according to 'move_type', using :
attrs='{"invisible":[('move_type', '=' ,'in_invoice')]}'
attrs='{"invisible":[('move_type', '=' ,'out_invoice')]}'
if move_type == 'in_invoice' --> field1 : invisible
if move_type == 'out_invoice' --> field2 : invisible
<record id="view_account_payment_register_form_inherit_payment_test" model="ir.ui.view">
<field name="name">account.payment.register.form.inherit.payment.test</field>
<field name="model">account.payment.register</field>
<field name="inherit_id" ref="account.view_account_payment_register_form"/>
<field name="arch" type="xml">
<xpath expr="//group/field[@name='communication']" position="after">
<field name="field1"/>
<field name="field2"/>
</xpath>
</field>
</record>
How can I do it ? Thanks.
I don't know what problem you're having because by using
<field name="field1" attrs="{'invisible': [('move_type', '=', 'in_invoice')]}" />
<field name="field2" attrs="{'invisible': [('move_type', '=', 'out_invoice')]}" />
It should have worked. But if you're trying to change the visibility of a field which is already in view that you're inheriting you may want to use
<field name="field1" position="attributes">
<attribute name="attrs">[('move_type', '=', 'in_invoice')]</attribute>
</field>
Can you specify more about the problem here.