I am using odoo 17, I have a form view for managing bank transactions. I want the credit and debit fields to be visible when creating a new transaction. However, after saving the transaction, I want these fields to be hidden and no longer visible on the form.
here's the form view:
<record id="view_oui_finance_transaction_form" model="ir.ui.view">
<field name="name">oui.finance.transaction.form</field>
<field name="model">oui.finance.transaction</field>
<field name="arch" type="xml">
<form string="Transactions">
<sheet>
<div class="oe_title">
<label for="reference" class="oe_edit_only"/>
<h1><field name="reference"/></h1>
</div>
<group>
<group>
<field name="date"/>
<field name="debit" modifiers="{'invisible': [['__mode', '!=', 'create']]}"/>
<field name="operation"/>
</group>
<group>
<field name="value_date"/>
<field name="credit" modifiers="{'invisible': [['__mode', '!=', 'create']]}"/>
<field name="account_id"/>
</group>
</group>
</sheet>
</form>
</field>
</record>