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.

92 lines
3.6 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"
  19. attrs="{'required': [('firstname', '=', False)]}"/>
  20. <field name="firstname"
  21. attrs="{'required': [('lastname', '=', False)]}"/>
  22. </group>
  23. </xpath>
  24. </data>
  25. </field>
  26. </record>
  27. <record id="view_partner_form_firstname" model="ir.ui.view">
  28. <field name="name">Add firstname and surnames</field>
  29. <field name="model">res.partner</field>
  30. <field name="inherit_id" ref="base.view_partner_form"/>
  31. <field name="arch" type="xml">
  32. <data>
  33. <xpath expr="//field[@name='name']" position="attributes">
  34. <attribute name="attrs">{
  35. 'readonly': [('is_company', '=', False)],
  36. 'required': [('is_company', '=', True)]
  37. }</attribute>
  38. </xpath>
  39. <xpath expr="//field[@name='category_id']" position="before">
  40. <group attrs="{'invisible': [('is_company', '=', True)]}">
  41. <field name="lastname"
  42. attrs="{'required': [('firstname', '=', False)]}"/>
  43. <field name="firstname"
  44. attrs="{'required': [('lastname', '=', False)]}"/>
  45. </group>
  46. </xpath>
  47. <!-- Modify inner contact form of child_ids -->
  48. <xpath expr="//field[@name='child_ids']/form
  49. //field[@name='category_id']"
  50. position="before">
  51. <group attrs="{'invisible': [('is_company', '=', True)]}">
  52. <field name="lastname"
  53. attrs="{'required': [('firstname', '=', False)]}"/>
  54. <field name="firstname"
  55. attrs="{'required': [('lastname', '=', False)]}"/>
  56. </group>
  57. </xpath>
  58. <xpath expr="//field[@name='child_ids']/form
  59. //field[@name='category_id']"
  60. position="attributes">
  61. <attribute name="style"/>
  62. </xpath>
  63. <xpath expr="//field[@name='child_ids']/form//label[@for='name']"
  64. position="before">
  65. <div class="oe_edit_only">
  66. <field name="is_company"
  67. on_change="onchange_type(is_company)"/>
  68. <label for="is_company"
  69. string="Is a Company?"/>
  70. </div>
  71. </xpath>
  72. <xpath expr="//field[@name='child_ids']/form//field[@name='name']"
  73. position="attributes">
  74. <attribute name="attrs">{
  75. 'readonly': [('is_company', '=', False)],
  76. 'required': [('is_company', '=', True)]
  77. }</attribute>
  78. </xpath>
  79. </data>
  80. </field>
  81. </record>
  82. </data>
  83. </openerp>