sale_order_views.xml 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <odoo>
  3. <record id="sale_order_view_form" model="ir.ui.view">
  4. <field name="name">sale.order.form.inherit.event.sale</field>
  5. <field name="model">sale.order</field>
  6. <field name="inherit_id" ref="sale.view_order_form" />
  7. <field name="arch" type="xml">
  8. <button name="action_preview_sale_order" position="before">
  9. <button name="action_view_attendee_list" type="object"
  10. class="oe_stat_button" icon="fa-users" attrs="{'invisible': [('attendee_count', '=', 0)]}">
  11. <field name="attendee_count" widget="statinfo" string="Attendees"/>
  12. </button>
  13. </button>
  14. <xpath expr="//field[@name='order_line']//form//field[@name='product_id']" position="after">
  15. <field
  16. name="event_id"
  17. domain="[
  18. ('event_ticket_ids.product_id','=', product_id),
  19. ('date_end','&gt;=',time.strftime('%Y-%m-%d 00:00:00')),
  20. '|', ('company_id', '=', False), ('company_id', '=', parent.company_id)
  21. ]"
  22. attrs="{'invisible': [('product_type', '!=', 'event')], 'required': [('product_type', '=', 'event')]}"
  23. options="{'no_open': True, 'no_create': True}"
  24. />
  25. <field
  26. name="event_ticket_id"
  27. domain="[
  28. ('event_id', '=', event_id), ('product_id','=',product_id),
  29. '|', ('company_id', '=', False), ('company_id', '=', parent.company_id)
  30. ]"
  31. attrs="{
  32. 'invisible': ['|', ('product_type', '!=', 'event'), ('event_id', '=', False)],
  33. 'required': [('product_type', '=', 'event'), ('event_id', '!=', False)],
  34. }"
  35. options="{'no_open': True, 'no_create': True}"
  36. />
  37. </xpath>
  38. <xpath expr="//field[@name='order_line']//tree//field[@name='product_template_id']" position="after">
  39. <field name="event_id" optional="hide" domain="['|', ('company_id', '=', False), ('company_id', '=', parent.company_id)]"/>
  40. <field name="event_ticket_id" optional="hide" domain="['|', ('company_id', '=', False), ('company_id', '=', parent.company_id)]"/>
  41. </xpath>
  42. </field>
  43. </record>
  44. </odoo>