Skip to Content
Menu
This question has been flagged
2 Replies
2814 Views

In res partner form I have a many2many field. But I do hide this field when is_company = False. So the question is, how can I fill up this field based on parent_id.

If is_company = False and parent_id = True i need to fill up multiply_pricelists_ids from parent_id.multiply_pricelists_ids

    <record id="view_res_partner_pricelist_form" model="ir.ui.view">
                <field name="name">view.res.partner.pricelist.form</field>
                <field name="model">res.partner</field>
                <field name="type">form</field>
                <field name="inherit_id" ref="product.view_partner_property_form" />
                <field name="context">{'readonly_by_pass': True}</field>
                <field name="arch" type="xml">
                    <group name="sale" position="inside">
                        <field name="multiply_pricelists_ids" widget="many2many_tags" attrs="{{'invisible: [('is_company' ,'=', False)],'required':['|',('parent_id','=',False), ('is_company','!=',False)]}"/>
                    </group>
  </field>
        </record>
Avatar
Discard
Best Answer

Hello @GRF, First i found your attrs syntax is wrong. You used '{' twice at start.

attrs="{{'invisible: [('is_company' ,'=', False)],'required':['|',('parent_id','=',False), ('is_company','!=',False)]}"
Please check it. i think it will work else we find another solution.
Avatar
Discard
Author

I already corrected this mistake

Best Answer

 


Avatar
Discard
Related Posts Replies Views Activity
0
Aug 22
949
0
Aug 24
117
1
Jun 18
3830
2
Dec 23
698
0
Jan 22
1447