[Python] How to get the current company in xml. Odoo 14

Discussão em 'Python' iniciado por Stack, Março 21, 2025.

  1. Stack

    Stack Membro Participativo

    I added a field (type char) in model 'account.payment.register',

    <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="company" attrs="{'invisible': [('journal_type', '=', 'cash')], 'required': [('journal_type', '=', 'bank')]}"/>
    </xpath>
    </field>
    </field>


    I want to add default value in field 'Company' according to these conditions:

    • if it is an 'outbound' payment , then Company must get the current company .
    • if it is an 'inbound' payment , Company get an empty field. Can I do it with xml code ? Any help please ? Thanks.

    Continue reading...

Compartilhe esta Página