odoo18/addons_extensions/ftp_feed/views/feed.xml

156 lines
7.4 KiB
XML

<?xml version="1.0" encoding="UTF-8" ?>
<odoo>
<record id="view_ftp_feed_form" model="ir.ui.view">
<field name="name">ftp.feed.form</field>
<field name="model">ftp.feed</field>
<field name="arch" type="xml">
<form string="Feed Post">
<sheet>
<div class="oe_title">
<h1>
<field name="user_id" class="oe_inline" readonly="1"/>
</h1>
<h2>
<field name="post_time" readonly="1"/>
</h2>
</div>
<group>
<group>
<field name="description" placeholder="What's on your mind?"/>
</group>
<group>
<field name="images" widget="many2many_binary" options="{'preview_images': true}"/>
</group>
</group>
<notebook>
<page string="Reactions">
<field name="like_count" widget="stat_info" string="Total Likes"/>
<field name="feed_data">
<list editable="bottom">
<field name="user_id"/>
<field name="feed_type"/>
<field name="create_date" readonly="1"/>
</list>
</field>
</page>
<page string="Comments">
<field name="comment_count" widget="stat_info" string="Total Comments"/>
<field name="feed_comments">
<list editable="bottom">
<field name="user_id"/>
<field name="feed_comment"/>
<field name="comment_time" readonly="1"/>
</list>
<form>
<group>
<field name="user_id" readonly="1"/>
<field name="feed_comment"/>
<field name="comment_time" readonly="1"/>
</group>
</form>
</field>
</page>
<page string="Author Info">
<field name="employee_id">
<form>
<group>
<field name="name"/>
<field name="create_date" readonly="1"/>
<field name="write_date" readonly="1"/>
</group>
</form>
</field>
</page>
</notebook>
</sheet>
</form>
</field>
</record>
<record id="view_ftp_feed_list" model="ir.ui.view">
<field name="name">ftp.feed.list</field>
<field name="model">ftp.feed</field>
<field name="arch" type="xml">
<list string="Feed Posts" decoration-info="like_count > 0" decoration-danger="like_count == 0">
<field name="user_id"/>
<field name="description" widget="text_emojis"/>
<field name="post_time"/>
<field name="like_count" widget="badge" invisible="1"/>
<field name="comment_count" widget="badge" invisible="1"/>
</list>
</field>
</record>
<record id="view_ftp_feed_kanban" model="ir.ui.view">
<field name="name">ftp.feed.kanban</field>
<field name="model">ftp.feed</field>
<field name="arch" type="xml">
<kanban default_group_by="user_id">
<field name="description"/>
<field name="images"/>
<field name="user_id"/>
<field name="post_time"/>
<field name="like_count"/>
<field name="comment_count"/>
<templates>
<t t-name="kanban-box">
<div class="oe_kanban_global_click o_kanban_record">
<div class="o_kanban_record_header">
<div class="o_kanban_record_title">
<field name="user_id" widget="hr_employee"/>
<small class="float-right">
<field name="post_time"/>
</small>
</div>
</div>
<div class="o_kanban_record_body">
<div t-if="record.description.raw_value"
widget="text_emojis" class="mb-2"/>
<div t-if="record.images.raw_value" class="d-flex flex-wrap">
<t t-foreach="record.images.raw_value.slice(0, 3)" t-as="img">
<img t-att-src="'/web/image/ir.attachment/' + img + '/datas/300x300'"
class="img-fluid m-1" style="max-height: 100px;"/>
</t>
<t t-if="record.images.raw_value.length > 3">
<div class="o_kanban_image_more ml-1">
+<t t-esc="record.images.raw_value.length - 3"/>
</div>
</t>
</div>
<div class="d-flex justify-content-between mt-2">
<div>
<i class="fa fa-thumbs-up mr-1"/>
<field name="like_count" widget="badge"/>
</div>
<div>
<i class="fa fa-comments mr-1"/>
<field name="comment_count" widget="badge"/>
</div>
</div>
</div>
</div>
</t>
</templates>
</kanban>
</field>
</record>
<!-- Actions -->
<record id="action_ftp_feed" model="ir.actions.act_window">
<field name="name">Social Feed</field>
<field name="res_model">ftp.feed</field>
<field name="view_mode">kanban,list,form</field>
<field name="context">{'default_user_id': uid}</field>
<field name="help" type="html">
<p class="o_view_nocontent_smiling_face">
Share updates with your team!
</p>
</field>
</record>
<!-- Menu -->
<menuitem id="menu_ftp_feed_root" name="Social Feed" sequence="10" web_icon="ftp_feed,static/description/banner.png"/>
<menuitem id="menu_ftp_feed" name="Feed" parent="menu_ftp_feed_root" sequence="20" action="action_ftp_feed"/>
</odoo>