Hello,
I've inherited the account.journal.form view and added 2 additional checkboxes (Bank & Visa) to the widget="many2many_checkboxes (via the data folder).
I also added 2 custom fields to the form view bank_account_number and visa_account_number.
How do I only show the bank_account_number field when the 'Bank' checkbox is selected AND the visa_account_number field when the 'Visa' checkbox is selected?
My Code:
models.py :
class payment_method(models.Model):
_inherit = 'account.journal'
bank_account_number = fields.Char(string='Bank Account Number', readonly=False)
visa_account_number = fields.Char(string='Visa Account Number', readonly=False)
views.xml :
<odoo>
<data>
<record id="view_account_journal_inherit" model="ir.ui.view">
<field name="name">account.journal.form.inherit</field>
<field name="model">account.journal</field>
<field name="priority" eval="40"/>
<field name="inherit_id" ref="account.view_account_journal_form"/>
<field name="arch" type="xml">
<xpath expr="//page[@name='advanced_settings']/group/group/field[@name='inbound_payment_method_ids']" position="after">
<field name="bank_account_number"/>
<field name="visa_account_number"/>
</xpath>
</field>
</record>
</data>
</odoo>
data folder > cust_payment_method.xml :
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data noupdate="1">
<!-- Payment methods -->
<record id="account_payment_method_bank_in" model="account.payment.method">
<field name="name">Bank</field>
<field name="code">bank</field>
<field name="payment_type">inbound</field>
</record>
<record id="account_payment_method_bank_out" model="account.payment.method">
<field name="name">Bank</field>
<field name="code">bank</field>
<field name="payment_type">outbound</field>
</record>
<record id="account_payment_method_visa_in" model="account.payment.method">
<field name="name">Visa</field>
<field name="code">visa</field>
<field name="payment_type">inbound</field>
</record>
<record id="account_payment_method_visa_out" model="account.payment.method">
<field name="name">Visa</field>
<field name="code">visa</field>
<field name="payment_type">outbound</field>
</record>
</data>
</odoo>
Any help is appreciated, thanks in advance.