server-ux/announcement/views/announcement_views.xml
2024-10-01 07:56:39 +02:00

242 lines
9.8 KiB
XML

<?xml version="1.0" encoding="utf-8" ?>
<!-- Copyright 2022 Tecnativa - David Vidal
License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). -->
<flectra>
<record id="announcement_log_view_tree" model="ir.ui.view">
<field name="model">announcement.log</field>
<field name="arch" type="xml">
<tree>
<field name="create_date" />
<field name="create_uid" />
</tree>
</field>
</record>
<record id="action_announcement_log" model="ir.actions.act_window">
<field name="name">Announcement Logs</field>
<field name="res_model">announcement.log</field>
<field name="context">{}</field>
<field name="domain">[('announcement_id', '=', active_id)]</field>
<field name="view_mode">tree</field>
</record>
<record id="announcement_view_tree" model="ir.ui.view">
<field name="model">announcement</field>
<field name="arch" type="xml">
<tree>
<field name="name" />
<field name="notification_date" />
<field name="notification_expiry_date" />
<field
name="tag_ids"
optional="hide"
widget="many2many_tags"
options="{'color_field': 'color'}"
/>
</tree>
</field>
</record>
<record id="announcement_management_view_tree" model="ir.ui.view">
<field name="model">announcement</field>
<field name="inherit_id" ref="announcement_view_tree" />
<!-- <field
name="groups_id"
eval="[(4, ref('announcement.announcemenent_manager'))]"
/> -->
<field name="arch" type="xml">
<field name="name" position="before">
<field name="sequence" widget="handle" />
</field>
<field name="notification_expiry_date" position="after">
<field name="read_announcement_count" string="Reads" />
<field name="allowed_users_count" string="Total users" />
</field>
</field>
</record>
<record id="announcement_view_form" model="ir.ui.view">
<field name="model">announcement</field>
<field name="arch" type="xml">
<form string="Announcement">
<sheet>
<div class="oe_button_box" name="button_box" />
<widget
name="web_ribbon"
title="Archived"
bg_color="bg-danger"
invisible="active"
/>
<div class="oe_title">
<h1>
<field
name="name"
required="1"
placeholder="e.g. Announcement description..."
/>
</h1>
</div>
<group>
<field name="is_general_announcement" />
</group>
<group>
<field name="active" invisible="1" />
<group name="announcement_validity">
<field name="notification_date" string="Announce at" />
<field
name="notification_expiry_date"
string="Valid up to"
/>
<field
name="tag_ids"
widget="many2many_tags"
options="{'color_field': 'color'}"
placeholder="Tags..."
/>
</group>
</group>
<group>
<field name="attachment_ids" widget="many2many_binary" />
</group>
<notebook>
<page name="content" string="Content">
<group>
<!-- TIP: We could use website widgets in the same way website.mass_mailing.popup does.
A compatibility module should be made thou -->
<field
name="content"
nolabel="1"
colspan="2"
placeholder="Set here the content of the announcement."
/>
</group>
</page>
</notebook>
</sheet>
</form>
</field>
</record>
<record id="announcement_management_view_form" model="ir.ui.view">
<field name="model">announcement</field>
<field name="inherit_id" ref="announcement_view_form" />
<!-- <field
name="groups_id"
eval="[(4, ref('announcement.announcemenent_manager'))]"
/> -->
<field name="arch" type="xml">
<xpath expr="//div[@name='button_box']" position="inside">
<button
type="object"
name="action_announcement_log"
icon="fa-book"
class="oe_stat_button"
>
<div class="o_stat_info">
<span class="o_stat_value">
<field name="read_announcement_count" /> / <field
name="allowed_users_count"
/>
</span>
<span class="o_stat_text">Read(s)</span>
</div>
</button>
</xpath>
<group name="announcement_validity" position="before">
<group name="announcement_scope" invisible="is_general_announcement">
<field name="announcement_type" />
<field
name="specific_user_ids"
string="Users"
options="{'no_create': True}"
invisible="announcement_type != 'specific_users'"
required="announcement_type == 'specific_users'"
widget="many2many_tags"
/>
<field
name="user_group_ids"
string="Groups"
options="{'no_create': True}"
invisible="announcement_type != 'user_group'"
required="announcement_type == 'user_group'"
widget="many2many_tags"
/>
</group>
</group>
</field>
</record>
<record id="announcement_view_kanban" model="ir.ui.view">
<field name="model">announcement</field>
<field name="arch" type="xml">
<kanban class="o_kanban_mobile">
<field name="name" />
<field name="content" />
<templates>
<t t-name="kanban-box">
<div t-attf-class="oe_kanban_card oe_kanban_global_click">
<div class="row mb4">
<div class="col-12">
<t t-esc="record.name.value" />
<t t-out="record.content.raw_value" />
</div>
</div>
</div>
</t>
</templates>
</kanban>
</field>
</record>
<record id="announcement_view_calendar" model="ir.ui.view">
<field name="model">announcement</field>
<field name="arch" type="xml">
<calendar
date_start="notification_start_date"
date_stop="notification_end_date"
string="name"
mode="month"
color="color"
hide_time="true"
>
<field name="notification_date" />
<field name="notification_expiry_date" />
<field name="tag_ids" />
</calendar>
</field>
</record>
<record id="announcement_view_search" model="ir.ui.view">
<field name="model">announcement</field>
<field name="arch" type="xml">
<search>
<field name="notification_date" />
<field name="notification_expiry_date" />
<field name="specific_user_ids" />
<field name="content" />
<field name="active" />
<field
name="tag_ids"
string="Tag"
filter_domain="[('tag_ids', 'child_of', self)]"
/>
<separator />
<filter
string="Active"
name="current"
domain="[('active', '=', True)]"
/>
<filter
string="Archived"
name="archived"
domain="[('active', '=', False)]"
/>
</search>
</field>
</record>
<record id="announcement_action" model="ir.actions.act_window">
<field name="name">Announcements</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">announcement</field>
<field name="view_mode">tree,kanban,calendar,form</field>
<field name="context">{}</field>
</record>
<menuitem
id="menu_announcement_management"
parent="mail.menu_root_discuss"
action="announcement_action"
/>
</flectra>