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.

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