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