Skip to Content
Meniu
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
Această întrebare a fost marcată
2 Răspunsuri
1477 Vizualizări

Hello Everyone

I am trying to hide a column in account move line depending on a condition, but rather than being invisible it only makes it readonly

here is my XML code


i also tried using column_invisible but it gives me this error

Error: for modifier "column_invisible": Cannot read properties of undefined (reading 'split')


this is my py code for the field calculation

fixed_assets_user_type_name = fields.Boolean(string='User Type Name', compute='_compute_user_type_name', store=True, default=False)
@api.onchange('account_id') def _compute_user_type_name(self): for record in self: if record.account_id.user_type_id.name == 'Fixed Assets': record.fixed_assets_user_type_name = True

Imagine profil
Abandonează
Cel mai bun răspuns

Hi,

To address the issue, you can use the attrs attribute to conditionally set the readonly property based on the value of fixed_assets_user_type_name. Here's an example of how you can modify your XML code:

In this example, replace your_view_id, your.view.name, your.model, your_column_name with your actual view ID, view name, model, and the name of the column you want to hide or make readonly.

<odoo>
    <data>
        <record id="view_res_partner_form_inherit" model="ir.ui.view">
            <field name="name">res.partner.form.inherit</field>
            <field name="model">res.partner</field>
            <field name="inherit_id" ref="base.view_partner_form"/>
            <field name="arch" type="xml">
                <xpath expr="//page[@name='contacts']/group[@name='contact']/field[@name='function']" position="after">
                    <field name="product_ids" widget="many2many_tags" options="{'no_create': True}" context="{'default_vendor_id': id}"/>
                </xpath>
            </field>
        </record>
    </data>
</odoo>


Hope it helps

Imagine profil
Abandonează
Autor Cel mai bun răspuns
                                                                                            


Imagine profil
Abandonează
Related Posts Răspunsuri Vizualizări Activitate
1
mai 19
4960
1
dec. 22
5759
0
sept. 22
2912
2
mar. 19
4554
1
aug. 25
127