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.

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