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.

54 lines
3.4 KiB

  1. <?xml version="1.0" encoding="utf-8"?>
  2. <!-- Copyright 2015 Tecnativa - Jairo Llopis
  3. Copyright 2017 Tecnativa - Pedro M. Baeza
  4. License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->
  5. <odoo>
  6. <record id="partner_simple_form" model="ir.ui.view">
  7. <field name="model">res.partner</field>
  8. <field name="inherit_id" ref="partner_firstname.view_partner_simple_form_firstname"/>
  9. <field name="arch" type="xml">
  10. <data>
  11. <xpath expr="//field[@name='firstname']" position="attributes">
  12. <attribute name="attrs">{'required': [('lastname', '=', False), ('lastname2', '=', False), ('is_company', '=', False), ('type', '=', 'contact')]}</attribute>
  13. </xpath>
  14. <xpath expr="//field[@name='lastname']" position="attributes">
  15. <attribute name="attrs">{'required': [('firstname', '=', False), ('lastname2', '=', False), ('is_company', '=', False), ('type', '=', 'contact')]}</attribute>
  16. </xpath>
  17. <xpath expr="//field[@name='lastname']" position="after">
  18. <field name="lastname2" attrs="{'required': [('firstname', '=', False), ('lastname', '=', False), ('is_company', '=', False), ('type', '=', 'contact')]}"/>
  19. </xpath>
  20. </data>
  21. </field>
  22. </record>
  23. <record id="partner_form" model="ir.ui.view">
  24. <field name="model">res.partner</field>
  25. <field name="inherit_id" ref="partner_firstname.view_partner_form_firstname"/>
  26. <field name="arch" type="xml">
  27. <data>
  28. <!-- Main form -->
  29. <xpath expr="//field[@name='firstname']" position="attributes">
  30. <attribute name="attrs">{'required': [('lastname', '=', False), ('lastname2', '=', False), ('is_company', '=', False), ('type', '=', 'contact')]}</attribute>
  31. </xpath>
  32. <xpath expr="//field[@name='lastname']" position="attributes">
  33. <attribute name="attrs">{'required': [('firstname', '=', False), ('lastname2', '=', False), ('is_company', '=', False), ('type', '=', 'contact')]}</attribute>
  34. </xpath>
  35. <xpath expr="//field[@name='lastname']" position="after">
  36. <field name="lastname2" attrs="{'required': [('firstname', '=', False), ('lastname', '=', False), ('is_company', '=', False), ('type', '=', 'contact')]}"/>
  37. </xpath>
  38. <!-- Inner contact form of child_ids -->
  39. <xpath expr="//field[@name='child_ids']/form//field[@name='firstname']" position="attributes">
  40. <attribute name="attrs">{'required': [('lastname', '=', False), ('lastname2', '=', False), ('is_company', '=', False), ('type', '=', 'contact')]}</attribute>
  41. </xpath>
  42. <xpath expr="//field[@name='child_ids']/form//field[@name='lastname']" position="attributes">
  43. <attribute name="attrs">{'required': [('firstname', '=', False), ('lastname2', '=', False), ('is_company', '=', False), ('type', '=', 'contact')]}</attribute>
  44. </xpath>
  45. <xpath expr="//field[@name='child_ids']/form//field[@name='lastname']" position="after">
  46. <field name="lastname2" attrs="{'required': [('firstname', '=', False), ('lastname', '=', False), ('is_company', '=', False), ('type', '=', 'contact')]}"/>
  47. </xpath>
  48. </data>
  49. </field>
  50. </record>
  51. </odoo>