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.

85 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="//field[@name='category_id']" 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="//field[@name='parent_id']/.." position="before">
  42. <div attrs="{'invisible': [('is_company', '=', True)]}">
  43. <label for="lastname" string="Lastname"/>
  44. <field name="lastname" attrs=
  45. "{'required': [('firstname', '=', False),
  46. ('is_company', '=', False)]}" class="oe_inline"/><br/>
  47. <label for="firstname" string="Firstname"/>
  48. <field name="firstname" attrs=
  49. "{'required': [('lastname', '=', False),
  50. ('is_company', '=', False)]}" class="oe_inline"/>
  51. </div>
  52. </xpath>
  53. <!-- Modify inner contact form of child_ids -->
  54. <xpath expr="//field[@name='child_ids']/form
  55. //field[@name='name']"
  56. position="before">
  57. <field name="is_company"/>
  58. <field name="lastname" attrs=
  59. "{'required': [('firstname', '=', False),
  60. ('is_company', '=', False)],
  61. 'invisible': [('is_company', '=', True)]}"/>
  62. <field name="firstname" attrs=
  63. "{'required': [('lastname', '=', False),
  64. ('is_company', '=', False)],
  65. 'invisible': [('is_company', '=', True)]}"/>
  66. </xpath>
  67. <xpath expr="//field[@name='child_ids']/form//field[@name='name']"
  68. position="attributes">
  69. <attribute name="attrs">{
  70. 'readonly': [('is_company', '=', False)],
  71. 'required': [('is_company', '=', True)]
  72. }</attribute>
  73. </xpath>
  74. </data>
  75. </field>
  76. </record>
  77. </data>
  78. </openerp>