in odoo i need to make journal_id field editable

53 views Asked by At

this the view code of journal_id in account move and i need to change it to become editable:

<field name="journal_id"
       invisible="context.get('default_journal_id') and context.get('type', 'entry') != 'entry'"
       groups="account.group_account_user"
       options="{'no_create': True}"
       domain="[('type', '=?', invoice_filter_type_domain)]"
       attrs="{'readonly': [('name', '!=', '/')]}"/>

i need to change the: attrs="{'readonly': [('name', '!=', '/')]}"/> to be read {'readonly': False} , i did make it readonly=false from python and its worked and i can see the field in fields is readonly false but when tried to also make it from view its still not working, i did try to inherit the view and change it but nothing happened even in views not added in the database:

<?xml version="1.0" encoding="utf-8"?>
<odoo>
    <data>
    <record model="ir.ui.view" id="view_journal_allow_edit">
        <field name="name">account.journalview.form</field>
        <field name="model">account.move</field>
        <field name="inherit_id" ref="account.view_move_form"/>
        <field name="arch" type="xml">
            <field name="journal_id" position="attributes">
                <attribute name="attrs">{'readonly': False}</attribute>
            </field>
        </field>
    </record>
    </data>
</odoo>
1

There are 1 answers

0
Sudhir Arya On

Try with this:

<attribute name="attrs">{}</attribute>

This way all the "attrs" will be reset and your field become editable.