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.

98 lines
4.0 KiB

  1. <?xml version="1.0" encoding="utf-8"?>
  2. <openerp>
  3. <data>
  4. <record id="view_partner_simple_form_firstname" model="ir.ui.view">
  5. <field name="name">Add firstname and lastname</field>
  6. <field name="model">res.partner</field>
  7. <field name="inherit_id" ref="base.view_partner_simple_form"/>
  8. <field name="arch" type="xml">
  9. <data>
  10. <xpath expr="//field[@name='name']" position="attributes">
  11. <attribute name="attrs">{
  12. 'readonly': [('is_company', '=', False)],
  13. 'required': [('is_company', '=', True)]
  14. }</attribute>
  15. </xpath>
  16. <xpath expr="//field[@name='category_id']" position="before">
  17. <group attrs="{'invisible': [('is_company', '=', True)]}">
  18. <field name="lastname" attrs=
  19. "{'required': [('firstname', '=', False),
  20. ('is_company', '=', False)]}"/>
  21. <field name="firstname" attrs=
  22. "{'required': [('lastname', '=', False),
  23. ('is_company', '=', False)]}"/>
  24. </group>
  25. </xpath>
  26. </data>
  27. </field>
  28. </record>
  29. <record id="view_partner_form_firstname" model="ir.ui.view">
  30. <field name="name">Add firstname and surnames</field>
  31. <field name="model">res.partner</field>
  32. <field name="inherit_id" ref="base.view_partner_form"/>
  33. <field name="arch" type="xml">
  34. <data>
  35. <xpath expr="//field[@name='name']" position="attributes">
  36. <attribute name="attrs">{
  37. 'readonly': [('is_company', '=', False)],
  38. 'required': [('is_company', '=', True)]
  39. }</attribute>
  40. </xpath>
  41. <xpath expr="//field[@name='category_id']" position="before">
  42. <group attrs="{'invisible': [('is_company', '=', True)]}">
  43. <field name="lastname" attrs=
  44. "{'required': [('firstname', '=', False),
  45. ('is_company', '=', False)]}"/>
  46. <field name="firstname" attrs=
  47. "{'required': [('lastname', '=', False),
  48. ('is_company', '=', False)]}"/>
  49. </group>
  50. </xpath>
  51. <!-- Modify inner contact form of child_ids -->
  52. <xpath expr="//field[@name='child_ids']/form
  53. //field[@name='category_id']"
  54. position="before">
  55. <group attrs="{'invisible': [('is_company', '=', True)]}">
  56. <field name="lastname" attrs=
  57. "{'required': [('firstname', '=', False),
  58. ('is_company', '=', False)]}"/>
  59. <field name="firstname" attrs=
  60. "{'required': [('lastname', '=', False),
  61. ('is_company', '=', False)]}"/>
  62. </group>
  63. </xpath>
  64. <xpath expr="//field[@name='child_ids']/form
  65. //field[@name='category_id']"
  66. position="attributes">
  67. <attribute name="style"/>
  68. </xpath>
  69. <xpath expr="//field[@name='child_ids']/form//label[@for='name']"
  70. position="before">
  71. <div class="oe_edit_only">
  72. <field name="is_company"
  73. on_change="onchange_type(is_company)"/>
  74. <label for="is_company"
  75. string="Is a Company?"/>
  76. </div>
  77. </xpath>
  78. <xpath expr="//field[@name='child_ids']/form//field[@name='name']"
  79. position="attributes">
  80. <attribute name="attrs">{
  81. 'readonly': [('is_company', '=', False)],
  82. 'required': [('is_company', '=', True)]
  83. }</attribute>
  84. </xpath>
  85. </data>
  86. </field>
  87. </record>
  88. </data>
  89. </openerp>