mirror of
https://gitlab.com/flectra-community/partner-contact.git
synced 2024-11-15 02:32:04 +00:00
90 lines
4.1 KiB
XML
90 lines
4.1 KiB
XML
<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>
|