| 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 | <div name="button_box" position="inside"> |
| 9 | <button name="action_view_attendee_list" |
| 10 | type="object" |
| 11 | class="oe_stat_button" |
| 12 | icon="fa-users" |
| 13 | invisible="attendee_count == 0"> |
| 14 | <field name="attendee_count" widget="statinfo" string="Attendees"/> |
| 15 | </button> |
| 16 | </div> |
| 17 | <xpath expr="//field[@name='order_line']//form//field[@name='product_id']" position="after"> |
| 18 | <field |
| 19 | name="event_id" |
| 20 | domain="[ |
| 21 | ('event_ticket_ids.product_id','=', product_id), |
| 22 | ('date_end','>=',time.strftime('%Y-%m-%d 00:00:00')), |
| 23 | '|', ('company_id', '=', False), ('company_id', '=', parent.company_id) |
| 24 | ]" |
| 25 | invisible="service_tracking != 'event'" |
| 26 | required="service_tracking == 'event'" |
| 27 | options="{'no_open': True, 'no_create': True}"/> |
| 28 | <field |
| 29 | name="event_slot_id" |
| 30 | domain="[('event_id','=', event_id)]" |
| 31 | invisible="not is_multi_slots or service_tracking != 'event'" |
| 32 | required="is_multi_slots and service_tracking == 'event'" |
| 33 | options="{'no_open': True, 'no_create': True}"/> |
| 34 | <field |
| 35 | name="event_ticket_id" |
| 36 | domain="[ |
| 37 | ('event_id', '=', event_id), ('product_id','=',product_id), |
| 38 | '|', ('company_id', '=', False), ('company_id', '=', parent.company_id) |
| 39 | ]" |
| 40 | invisible="service_tracking != 'event' or not event_id" |
| 41 | required="service_tracking == 'event' and event_id" |
| 42 | options="{'no_open': True, 'no_create': True}"/> |
| 43 | </xpath> |
| 44 | <xpath expr="//field[@name='order_line']//list//field[@name='product_template_id']" position="after"> |
| 45 | <field name="event_id" |
| 46 | column_invisible="True" |
| 47 | domain="[ |
| 48 | ('event_ticket_ids.product_id','=', product_id), |
| 49 | ('date_end','>=',time.strftime('%Y-%m-%d 00:00:00')), |
| 50 | '|', ('company_id', '=', False), ('company_id', '=', parent.company_id) |
| 51 | ]" |
| 52 | required="service_tracking == 'event'" |
| 53 | options="{'no_open': True, 'no_create': True}" |
| 54 | placeholder="All Events"/> |
| 55 | <field |
| 56 | name="event_slot_id" |
| 57 | column_invisible="True" |
| 58 | domain="[('event_id','=', event_id)]" |
| 59 | required="is_multi_slots and service_tracking == 'event'" |
| 60 | options="{'no_open': True, 'no_create': True}"/> |
| 61 | <field name="event_ticket_id" |
| 62 | column_invisible="True" |
| 63 | domain="[ |
| 64 | ('event_id', '=', event_id), ('product_id','=',product_id), |
| 65 | '|', ('company_id', '=', False), ('company_id', '=', parent.company_id) |
| 66 | ]" |
| 67 | required="service_tracking == 'event' and event_id" |
| 68 | options="{'no_open': True, 'no_create': True}"/> |
| 69 | </xpath> |
| 70 | </field> |
| 71 | </record> |
| 72 | </odoo> |