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

  1. <?xml version="1.0" encoding="utf-8"?>
  2. <!--
  3. Odoo, Open Source Management Solution
  4. Author: Nicolas Bessi. Copyright Camptocamp SA
  5. Copyright (C)
  6. 2014: Agile Business Group (<http://www.agilebg.com>)
  7. 2015: Grupo ESOC <www.grupoesoc.es>
  8. This program is free software: you can redistribute it and/or modify
  9. it under the terms of the GNU Affero General Public License as published by
  10. the Free Software Foundation, either version 3 of the License, or
  11. (at your option) any later version.
  12. This program is distributed in the hope that it will be useful,
  13. but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. GNU Affero General Public License for more details.
  16. You should have received a copy of the GNU Affero General Public License
  17. along with this program. If not, see <http://www.gnu.org/licenses/>.
  18. -->
  19. <openerp>
  20. <data>
  21. <record id="partner_simple_form" model="ir.ui.view">
  22. <field name="name">Add firstname and lastname</field>
  23. <field name="model">res.partner</field>
  24. <field name="inherit_id" ref="base.view_partner_simple_form"/>
  25. <field name="arch" type="xml">
  26. <data>
  27. <xpath expr="//field[@name='name']" position="attributes">
  28. <attribute name="attrs">{
  29. 'readonly': [('is_company', '=', False)],
  30. 'required': [('is_company', '=', True)]
  31. }</attribute>
  32. </xpath>
  33. <xpath expr="//field[@name='category_id']" position="before">
  34. <group attrs="{'invisible': [('is_company', '=', True)]}">
  35. <field name="lastname"
  36. attrs="{'required': [('firstname', '=', False)]}"/>
  37. <field name="firstname"
  38. attrs="{'required': [('lastname', '=', False)]}"/>
  39. </group>
  40. </xpath>
  41. </data>
  42. </field>
  43. </record>
  44. <record id="partner_form" model="ir.ui.view">
  45. <field name="name">Add firstname and surnames</field>
  46. <field name="model">res.partner</field>
  47. <field name="inherit_id" ref="base.view_partner_form"/>
  48. <field name="arch" type="xml">
  49. <data>
  50. <xpath expr="//field[@name='name']" position="attributes">
  51. <attribute name="attrs">{
  52. 'readonly': [('is_company', '=', False)],
  53. 'required': [('is_company', '=', True)]
  54. }</attribute>
  55. </xpath>
  56. <xpath expr="//field[@name='category_id']" position="before">
  57. <group attrs="{'invisible': [('is_company', '=', True)]}">
  58. <field name="lastname"
  59. attrs="{'required': [('firstname', '=', False)]}"/>
  60. <field name="firstname"
  61. attrs="{'required': [('lastname', '=', False)]}"/>
  62. </group>
  63. </xpath>
  64. <!-- Modify inner contact form of child_ids -->
  65. <xpath expr="//field[@name='child_ids']/form
  66. //field[@name='category_id']"
  67. position="before">
  68. <group attrs="{'invisible': [('is_company', '=', True)]}">
  69. <field name="lastname"
  70. attrs="{'required': [('firstname', '=', False)]}"/>
  71. <field name="firstname"
  72. attrs="{'required': [('lastname', '=', False)]}"/>
  73. </group>
  74. </xpath>
  75. <xpath expr="//field[@name='child_ids']/form
  76. //field[@name='category_id']"
  77. position="attributes">
  78. <attribute name="style"/>
  79. </xpath>
  80. <xpath expr="//field[@name='child_ids']/form//label[@for='name']"
  81. position="before">
  82. <div class="oe_edit_only">
  83. <field name="is_company"
  84. on_change="onchange_type(is_company)"/>
  85. <label for="is_company"
  86. string="Is a Company?"/>
  87. </div>
  88. </xpath>
  89. <xpath expr="//field[@name='child_ids']/form//field[@name='name']"
  90. position="attributes">
  91. <attribute name="attrs">{
  92. 'readonly': [('is_company', '=', False)],
  93. 'required': [('is_company', '=', True)]
  94. }</attribute>
  95. </xpath>
  96. </data>
  97. </field>
  98. </record>
  99. </data>
  100. </openerp>