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.

105 lines
4.7 KiB

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