partner-contact/partner_firstname/views/res_partner.xml

90 lines
4.1 KiB
XML
Raw Normal View History

2024-05-03 08:58:43 +00:00
<flectra>
<record id="view_partner_simple_form" model="ir.ui.view">
<field name="model">res.partner</field>
<field name="inherit_id" ref="base.view_partner_simple_form" />
<field name="arch" type="xml">
<xpath expr="//field[@id='individual']" position="attributes">
<attribute name="invisible">is_company</attribute>
<attribute name="readonly">not is_company</attribute>
<attribute name="required">type == 'contract' and is_company</attribute>
</xpath>
<xpath expr="//field[@id='company']" position="attributes">
<attribute name="invisible">is_company == False</attribute>
<attribute name="readonly">not is_company</attribute>
<attribute name="required">type == 'contract' and is_company</attribute>
</xpath>
<xpath expr="//h1//field[@id='company']/.." position="before">
<group invisible="is_company">
<field
name="lastname"
required="not firstname and not is_company and type == 'contact'"
/>
<field
name="firstname"
required="not lastname and not is_company and type == 'contact'"
/>
</group>
</xpath>
</field>
</record>
<record id="view_partner_form" model="ir.ui.view">
<field name="model">res.partner</field>
<field name="inherit_id" ref="base.view_partner_form" />
<field name="arch" type="xml">
<xpath expr="//field[@id='individual']" position="attributes">
<attribute name="invisible">is_company</attribute>
<attribute name="readonly">not is_company</attribute>
<attribute name="required">type == 'contract' and is_company</attribute>
</xpath>
<xpath expr="//field[@id='company']" position="attributes">
<attribute name="invisible">not is_company</attribute>
<attribute name="readonly">not is_company</attribute>
<attribute name="required">type == 'contract' and is_company</attribute>
</xpath>
<xpath
expr="//div[hasclass('oe_title')]//field[@id='company']/.."
position="after"
>
<div class="oe_edit_only">
<group invisible="is_company">
<field
name="lastname"
required="not firstname and not is_company and type == 'contact'"
/>
<field
name="firstname"
required="not lastname and not is_company and type == 'contact'"
/>
</group>
</div>
</xpath>
<!-- Modify inner contact form of child_ids -->
<xpath
expr="//field[@name='child_ids']/form//field[@name='name']"
position="attributes"
>
<attribute name="readonly">not is_company</attribute>
<attribute name="required">is_company</attribute>
</xpath>
<xpath
expr="//field[@name='child_ids']/form//field[@name='name']"
position="after"
>
<div class="oe_edit_only" colspan="2">
<field name="is_company" invisible="True" />
<group invisible="is_company">
<field
name="lastname"
required="not firstname and not is_company and type == 'contact'"
/>
<field
name="firstname"
required="not lastname and not is_company and type == 'contact'"
/>
</group>
</div>
</xpath>
</field>
</record>
</flectra>