You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

113 lines
4.4 KiB

<?xml version="1.0" encoding="utf-8"?>
<!--
Odoo, Open Source Management Solution
Author: Nicolas Bessi. Copyright Camptocamp SA
Copyright (C)
2014: Agile Business Group (<http://www.agilebg.com>)
2015: Grupo ESOC <www.grupoesoc.es>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<openerp>
<data>
<record id="partner_simple_form" model="ir.ui.view">
<field name="name">Add firstname and lastname</field>
<field name="model">res.partner</field>
<field name="inherit_id" ref="base.view_partner_simple_form"/>
<field name="arch" type="xml">
<data>
<xpath expr="//field[@name='name']" position="attributes">
<attribute name="attrs">{
'readonly': [('is_company', '=', False)],
'required': [('is_company', '=', True)]
}</attribute>
</xpath>
<xpath expr="//field[@name='category_id']" position="before">
<group attrs="{'invisible': [('is_company', '=', True)]}">
<field name="lastname"
attrs="{'required': [('firstname', '=', False)]}"/>
<field name="firstname"
attrs="{'required': [('lastname', '=', False)]}"/>
</group>
</xpath>
</data>
</field>
</record>
<record id="partner_form" model="ir.ui.view">
<field name="name">Add firstname and surnames</field>
<field name="model">res.partner</field>
<field name="inherit_id" ref="base.view_partner_form"/>
<field name="arch" type="xml">
<data>
<xpath expr="//field[@name='name']" position="attributes">
<attribute name="attrs">{
'readonly': [('is_company', '=', False)],
'required': [('is_company', '=', True)]
}</attribute>
</xpath>
<xpath expr="//field[@name='category_id']" position="before">
<group attrs="{'invisible': [('is_company', '=', True)]}">
<field name="lastname"
attrs="{'required': [('firstname', '=', False)]}"/>
<field name="firstname"
attrs="{'required': [('lastname', '=', False)]}"/>
</group>
</xpath>
<!-- Modify inner contact form of child_ids -->
<xpath expr="//field[@name='child_ids']/form
//field[@name='category_id']"
position="before">
<group attrs="{'invisible': [('is_company', '=', True)]}">
<field name="lastname"
attrs="{'required': [('firstname', '=', False)]}"/>
<field name="firstname"
attrs="{'required': [('lastname', '=', False)]}"/>
</group>
</xpath>
<xpath expr="//field[@name='child_ids']/form
//field[@name='category_id']"
position="attributes">
<attribute name="style"/>
</xpath>
<xpath expr="//field[@name='child_ids']/form//label[@for='name']"
position="before">
<div class="oe_edit_only">
<field name="is_company"
on_change="onchange_type(is_company)"/>
<label for="is_company"
string="Is a Company?"/>
</div>
</xpath>
<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>
</data>
</field>
</record>
</data>
</openerp>