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.

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