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.
137 lines
6.1 KiB
137 lines
6.1 KiB
<?xml version="1.0" encoding="utf-8"?>
|
|
<odoo>
|
|
|
|
<record id="restaurant_booking_form" model="ir.ui.view">
|
|
<field name="name">Booking restaurant.booking form</field>
|
|
<field name="model">restaurant.booking</field>
|
|
<field name="arch" type="xml">
|
|
<form>
|
|
<sheet>
|
|
<div class="oe_title">
|
|
<label for="name" class="oe_edit_only"/>
|
|
<h1>
|
|
<field name="name"/>
|
|
</h1>
|
|
</div>
|
|
<group>
|
|
<group>
|
|
<field name="date" class="oe_inline"/>
|
|
<label for="time_start" string="Times"/>
|
|
<div class="o_row">
|
|
<span>from</span>
|
|
<field name="time_start" class="oe_inline" widget="float_time"/>
|
|
<span>to</span>
|
|
<field name="time_stop" class="oe_inline" widget="float_time"/>
|
|
</div>
|
|
<field name="duration" class="oe_inline" widget="float_time"/>
|
|
<field name="datetime_start" invisible="1"/>
|
|
<field name="datetime_stop" invisible="1"/>
|
|
</group>
|
|
<group>
|
|
<field name="count" class="oe_inline"/>
|
|
<field name="available_table_ids" invisible="1"/>
|
|
<field name="table_ids" widget="many2many_tags" options="{'no_create':1}"
|
|
attrs="{'invisible': ['|',('datetime_start','=',False),('datetime_stop','=',False)]}"/>
|
|
<field name="table_capacity" invisible="1"/>
|
|
<field name="table_capacity_ok" invisible="1"/>
|
|
<div colspan="2" class="text-muted mt16" attrs="{'invisible':[('table_capacity_ok','=',True)]}">
|
|
<i icon="fa-exclamation-triangle" class="text-warning"/>
|
|
<span class="ml8">The total seats of selected tables is lower than the people count.</span>
|
|
</div>
|
|
</group>
|
|
</group>
|
|
</sheet>
|
|
</form>
|
|
</field>
|
|
</record>
|
|
|
|
<record id="restaurant_booking_tree" model="ir.ui.view">
|
|
<field name="name">Booking restaurant.booking tree</field>
|
|
<field name="model">restaurant.booking</field>
|
|
<field name="arch" type="xml">
|
|
<tree expand="true">
|
|
<field name="name"/>
|
|
<field name="date"/>
|
|
<field name="time_start" widget="float_time"/>
|
|
<field name="time_stop" widget="float_time"/>
|
|
<field name="duration" widget="float_time"/>
|
|
<field name="count"/>
|
|
<field name="table_ids" widget="many2many_tags"/>
|
|
<field name="available_table_ids" invisible="1"/>
|
|
</tree>
|
|
</field>
|
|
</record>
|
|
|
|
<record id="restaurant_booking_search" model="ir.ui.view">
|
|
<field name="name">Booking restaurant.booking search</field>
|
|
<field name="model">restaurant.booking</field>
|
|
<field name="arch" type="xml">
|
|
<search>
|
|
<field name="name"/>
|
|
<field name="date"/>
|
|
<field name="table_ids"/>
|
|
<group expand="0" string="Filters">
|
|
<filter name="today" string="Today" domain="[('date','=',context_today().strftime('%Y-%m-%d'))]"/>
|
|
<filter name="tomorrow" string="Tomorrow" domain="[('date','=',(context_today() + relativedelta(days=1)).strftime('%Y-%m-%d'))]"/>
|
|
<filter name="next_we" string="Next wednesday" domain="[('date','=',(context_today() + relativedelta(weeks=context_today().weekday() >= 3 and 1 or 0, weekday=2)).strftime('%Y-%m-%d'))]"/>
|
|
<filter name="next_sa" string="Next saturday" domain="[('date','=',(context_today() + relativedelta(weeks=context_today().weekday() >= 5 and 1 or 0, weekday=5)).strftime('%Y-%m-%d'))]"/>
|
|
<filter name="next_su" string="Next sunday" domain="[('date','=',(context_today() + relativedelta(weeks=context_today().weekday() >= 6 and 1 or 0, weekday=6)).strftime('%Y-%m-%d'))]"/>
|
|
<separator/>
|
|
<filter name="this_week" string="This week" domain="[('date','>=',(context_today() + relativedelta(weekday=0)).strftime('%Y-%m-%d')),('date','<=',(context_today() + relativedelta(weekday=6)).strftime('%Y-%m-%d'))]"/>
|
|
<filter name="next_week" string="Next week" domain="[('date','>=',(context_today() + relativedelta(weeks=1, weekday=0)).strftime('%Y-%m-%d')),('date','<=',(context_today() + relativedelta(weeks=1, weekday=6)).strftime('%Y-%m-%d'))]"/>
|
|
<separator/>
|
|
<filter name="upcoming" string="Upcoming" domain="[('date','>=',context_today().strftime('%Y-%m-%d'))]"/>
|
|
</group>
|
|
<group expand="0" string="Group By">
|
|
<filter name="by_date" string="Date" domain="[]" context="{'group_by': 'date:day'}"/>
|
|
</group>
|
|
</search>
|
|
</field>
|
|
</record>
|
|
|
|
<record id="restaurant_booking_act_window" model="ir.actions.act_window">
|
|
<field name="name">All bookings</field>
|
|
<field name="res_model">restaurant.booking</field>
|
|
<field name="view_mode">tree,form</field>
|
|
<field name="context">{'search_default_upcoming':1, 'search_default_this_week':1, 'search_default_by_date':1}</field>
|
|
<field name="help" type="html">
|
|
<p class="o_view_nocontent_smiling_face">
|
|
Schedule a new booking.
|
|
</p><p>
|
|
To book, you must provide a name, a date, start and stop hours, the people count and one or more tables.
|
|
</p>
|
|
</field>
|
|
</record>
|
|
|
|
<record id="create_new_booking_act_window" model="ir.actions.act_window">
|
|
<field name="name">New booking</field>
|
|
<field name="type">ir.actions.act_window</field>
|
|
<field name="res_model">restaurant.booking</field>
|
|
<field name="view_id" ref="restaurant_booking_form"/>
|
|
<field name="target">new</field>
|
|
</record>
|
|
|
|
<menuitem
|
|
id="restaurant_booking_root_menu"
|
|
name="Bookings"
|
|
parent="point_of_sale.menu_point_root"
|
|
sequence="5"
|
|
groups="point_of_sale.group_pos_user"/>
|
|
|
|
<menuitem
|
|
id="restaurant_new_booking_menu"
|
|
name="New booking"
|
|
parent="restaurant_booking_root_menu"
|
|
action="create_new_booking_act_window"
|
|
sequence="10"
|
|
groups="point_of_sale.group_pos_user"/>
|
|
|
|
<menuitem
|
|
id="restaurant_booking_menu"
|
|
name="All bookings"
|
|
parent="restaurant_booking_root_menu"
|
|
action="restaurant_booking_act_window"
|
|
sequence="30"
|
|
groups="point_of_sale.group_pos_user"/>
|
|
|
|
</odoo>
|