添加功能

This commit is contained in:
zhouzhou
2024-09-12 18:56:36 +08:00
parent 7e0a94e212
commit 2ce03c4fed
2 changed files with 36 additions and 29 deletions
+9
View File
@@ -21,4 +21,13 @@ class CalendarEvent(models.Model):
"view_mode": "form",
"res_model": "room.booking",
"views": [[self.env.ref('room.room_booking_view_form').id, "form"]]
}
def button_dates(self):
return {
"name": _("日程"),
"type": "ir.actions.act_window",
"view_mode": "form",
"res_model": "calendar.event",
"views": [[self.env.ref('calendar.view_calendar_event_form').id, "form"]]
}
+27 -29
View File
@@ -62,37 +62,35 @@
</field>
</record>
<record id="room_view_calendar_event_form_quick_create" model="ir.ui.view">
<field name="name">room_calendar.event.form.quick_create</field>
<record id="inherit_calender_view_form" model="ir.ui.view">
<field name="name">inherit.calender.view.form</field>
<field name="model">calendar.event</field><!-- 指定模型 -->
<field name="arch" type="xml" >
<form create="0" delete="0" edit="0">
<sheet>
<div class="row">
<div class="col-6 text-center">
<button name="button_dates" string="安排日程" type="object" class="btn btn-primary"/>
</div>
<div class="col-6 text-center">
<button name="button_meet" string="安排会议" type="object" class="btn btn-primary"/>
</div>
</div>
</sheet>
<footer>
</footer>
</form>
</field>
</record>
<record id="room_view_calendar_event_calendar" model="ir.ui.view">
<field name="name">room.inherit.calendar.event.form.founded</field>
<field name="model">calendar.event</field>
<field name="inherit_id" ref="calendar.view_calendar_event_form_quick_create"/>
<field name="inherit_id" ref="calendar.view_calendar_event_calendar"/>
<field name="arch" type="xml">
<xpath expr="//sheet" position="replace">
<field name="recurrence_update" invisible="1"/>
<field name="videocall_source" invisible="1"/>
<field name="access_token" invisible="1"/>
<button name="button_meet" string="安排会议" type="object" class="btn-primary"/>
<div class="o_row">
<h1 class="w-100">
<field name="name" nolabel="1" placeholder="Add title" colspan="2"/>
</h1>
</div>
<group>
<field name="start_date" widget="daterange" options="{'end_date_field': 'stop_date'}"
invisible="not allday" required="allday"/>
<field name="start" widget="daterange" options="{'end_date_field': 'stop'}" invisible="allday"
required="not allday"/>
<field name="stop_date" invisible="1"/>
<field name="stop" invisible="1"/>
<field name="allday"/>
<field name="partner_ids" widget="many2manyattendee"
placeholder="Add attendees..."
options="{'no_quick_create': True}"
context="{'form_view_ref': 'base.view_partner_simple_form'}"
class="oe_inline"
/>
<field name="description" placeholder="Describe your meeting"/>
</group>
<xpath expr="//calendar" position="attributes">
<attribute name="quick_create_view_id">%(room.inherit_calender_view_form)d</attribute>
</xpath>
</field>
</record>