Browse Source

[FIX] partner_firstname: Better practices in views

pull/663/head
Pedro M. Baeza 9 years ago
committed by Jairo Llopis
parent
commit
b02636c386
  1. 26
      partner_firstname/partner_view.xml
  2. 18
      partner_firstname/res_user_view.xml

26
partner_firstname/partner_view.xml

@ -32,29 +32,27 @@
</group>
</field>
<!-- Add firstname and last name in inner contact form of child_ids -->
<xpath expr="//form[@string='Contact']/sheet//field[@name='category_id']" position="before">
<xpath expr="//field[@name='child_ids']/form//field[@name='category_id']" position="before">
<group attrs="{'invisible': [('is_company', '=', True)]}">
<field name="lastname" attrs="{'required': [('is_company', '=', False)]}"/>
<field name="firstname"/>
</group>
<field name="lastname" attrs="{'required': [('is_company', '=', False)]}"/>
<field name="firstname"/>
</group>
</xpath>
<xpath expr="//form[@string='Contact']/sheet//field[@name='category_id']" position="attributes">
<xpath expr="//field[@name='child_ids']/form//field[@name='category_id']" position="attributes">
<attribute name="style"/>
</xpath>
<xpath expr="//form[@string='Contact']/sheet/div/label" position="replace">
<xpath expr="//field[@name='child_ids']/form//label[@for='name']" position="before">
<div class="oe_edit_only">
<label for="name"/> (
<field name="is_company" on_change="onchange_type(is_company)" class="oe_inline"/>
<label for="is_company" string="Is a Company?"/>)
<field name="is_company"
on_change="onchange_type(is_company)"/>
<label for="is_company"
string="Is a Company?"/>
</div>
</xpath>
<xpath expr="//form[@string='Contact']/sheet/div/h1/field[@name='name']" position="attributes">
<div class="oe_edit_only">
<attribute name="attrs">{'readonly': [('is_company', '=', False)], 'required': [('is_company', '=', True)]}</attribute>
</div>
<xpath expr="//field[@name='child_ids']/form//field[@name='name']" position="attributes">
<attribute name="attrs">{'readonly': [('is_company', '=', False)], 'required': [('is_company', '=', True)]}</attribute>
</xpath>
</field>
</record>

18
partner_firstname/res_user_view.xml

@ -9,17 +9,23 @@
<field name="inherit_id" ref="base.view_users_form"/>
<field name="arch" type="xml">
<label for="name" position="replace">
<label for="firstname" class="oe_edit_only"/>
<label for="name" position="attributes">
<attribute name="invisible">1</attribute>
</label>
<label for="name" position="after">
<label for="firstname" class="oe_edit_only"/>
</label>
<field name="name" position="replace">
<field name="firstname"/>
<field name="name" position="attributes">
<attribute name="invisible">1</attribute>
</field>
<field name="name" position="after">
<field name="firstname"/>
</field>
<label for="login" position="before">
<label for="lastname" class="oe_edit_only"/>
<h1><field name="lastname"/></h1>
<label for="lastname" class="oe_edit_only"/>
<h1><field name="lastname"/></h1>
</label>
</field>

Loading…
Cancel
Save