1
0
forked from Mapan/odoo17e
odoo17e-kedaikipas58/addons/room/views/room_room_views.xml
2024-12-10 09:04:09 +07:00

155 lines
7.4 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="room_room_view_search" model="ir.ui.view">
<field name="name">Room search view</field>
<field name="model">room.room</field>
<field name="arch" type="xml">
<search string="Room">
<field name="name" string="Room"/>
<field name="office_id"/>
<field name="company_id" groups="base.group_multi_company"/>
<filter name="group_by_office_id" context="{'group_by': 'office_id'}"/>
<filter name="group_by_company_id" context="{'group_by': 'company_id'}" groups="base.group_multi_company"/>
<searchpanel>
<field name="company_id"/>
<field name="office_id" select="multi" domain="[['company_id', '=', company_id]]" enable_counters="1" icon="fa-building"/>
</searchpanel>
</search>
</field>
</record>
<record id="room_room_view_kanban" model="ir.ui.view">
<field name="name">room.room.view.kanban</field>
<field name="model">room.room</field>
<field name="arch" type="xml">
<kanban>
<field name="is_available"/>
<field name="next_booking_start"/>
<templates>
<t t-name="kanban-box">
<div class="oe_kanban_global_click o_kanban_record_has_image_fill">
<field invisible="not room_background_image" name="room_background_image" class="o_kanban_image_fill_left" options="{'size': [150,100]}" widget="image"/>
<div class="oe_kanban_details ml8">
<div class="o_kanban_record_top">
<strong class="o_kanban_record_title">
<field name="name"/>
</strong>
</div>
<div class="o_kanban_record_bottom">
<div t-attf-class="py-1 px-2 text-bg-#{record.is_available.raw_value ? 'success' : 'danger'}">
<t t-if="record.is_available.raw_value">Available</t>
<t t-else="">Busy</t>
<!-- Show time if next booking is today, otherwise show date -->
<t t-if="record.next_booking_start.value">
<t t-set="start_datetime"
t-value="luxon.DateTime.fromISO(record.next_booking_start.raw_value)"/>
Until
<t t-if="start_datetime.hasSame(luxon.DateTime.now(), 'day')"
t-out="start_datetime.toLocaleString(luxon.DateTime.TIME_SIMPLE)"/>
<t t-else="" t-out="start_datetime.toLocaleString(luxon.DateTime.DATE_SHORT)"/>
</t>
</div>
</div>
</div>
</div>
</t>
</templates>
</kanban>
</field>
</record>
<record id="room_room_view_list" model="ir.ui.view">
<field name="name">room.room.view.list</field>
<field name="model">room.room</field>
<field name="arch" type="xml">
<tree>
<field name="name"/>
<field name="office_id"/>
<field name="is_available" string="Is Currently Available"/>
<field name="next_booking_start"/>
</tree>
</field>
</record>
<record id="room_room_view_form" model="ir.ui.view">
<field name="name">room.room.view.form</field>
<field name="model">room.room</field>
<field name="arch" type="xml">
<form>
<field name="is_available" invisible="1"/>
<header>
<button string="Open" type="object" name="action_open_booking_view"/>
</header>
<sheet>
<div class="oe_button_box" name="button_box">
<button name="action_view_bookings" type="object"
class="oe_stat_button" icon="fa-calendar">
<div class="o_form_field o_stat_info">
<span class="o_stat_text">
<field class="o_stat_value me-1" name="bookings_count"/>
<span invisible="bookings_count == 1">Bookings</span>
<span invisible="bookings_count != 1">Booking</span>
</span>
</div>
</button>
</div>
<div class="badge rounded-pill text-bg-success float-end fs-6 border-0" invisible="not is_available">
Available
</div>
<div class="badge rounded-pill text-bg-danger float-end fs-6 border-0" invisible="is_available">
Busy
</div>
<div class="oe_title mb24">
<label for="name"/>
<h1>
<field name="name" placeholder="Room Name"/>
</h1>
<div class="o_row">
<field name="office_id"/>
</div>
</div>
<group>
<group>
<field name="short_code"/>
</group>
<group>
<field name="room_booking_url" widget="CopyClipboardChar"/>
</group>
</group>
<notebook>
<page name="Appearance">
<group>
<group>
<field name="bookable_background_color" widget="color"/>
<field name="booked_background_color" widget="color"/>
</group>
<group>
<field name="room_background_image" widget="image"/>
</group>
</group>
</page>
<page name="Amenities">
<field name="description" placeholder="E.g. projector, capacity 6 people"/>
</page>
</notebook>
</sheet>
</form>
</field>
</record>
<record id="room_room_action" model="ir.actions.act_window">
<field name="name">Room</field>
<field name="res_model">room.room</field>
<field name="view_mode">kanban,list,form</field>
<field name="help" type="html">
<p class="o_view_nocontent_smiling_face">
Create Rooms
</p>
<p>
They can then be booked for meetings from a Tablet or the back-end.
</p>
</field>
</record>
</odoo>