Purpose
=======
Whenever a visitor start a livechat session but finally close the session
without sending any messages, the livechat session is empty and stay in DB.
Livechat session counter counts all the sessions (with and without message)
but when opening the sessions tree view, the view is filtered by default on
session with messages. There is no reason to see the empty sessions as it
does not give any information (except "the visitor hesitated to start
livechat and finally did not" which is quite useless info)
The goal is to keep only sessions with messages.
When the visitor is closing the livechat window, if the session is empty,
the session should be deleted. But what happens if a visitor start a livechat
session, send no message and just leave the website without closing the
livechat window ? --> empty live chat session will remains in database.
The ir_autovacuum already handle the deletion of empty sessions to main a
clean DB.
Specifications
==============
- Apply 'with messages' domain on session count in the livechat channel view
- Apply 'with messages' domain on session count in the lead view
- Apply 'with messages' domain on livechat session view
- Remove With message filter
- Remove Without message filter
- If send message on a deleted session :
just tell the visitor that operator is not available anymore
AND delete livechat session cookie (as he waited 1 day to send a message)
Empty sessions becomes invisible : not possible for users to see empty session
(in count or in views) and cron is cleaning empty sessions every day.
This commit also adapts visitor session count and view accordingly.
Task ID: 2146962
PR #41065
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
156 lines
8.6 KiB
XML
156 lines
8.6 KiB
XML
<?xml version="1.0"?>
|
|
<odoo>
|
|
<data>
|
|
|
|
<record id="mail_channel_view_search" model="ir.ui.view">
|
|
<field name="name">mail.channel.search</field>
|
|
<field name="model">mail.channel</field>
|
|
<field name="arch" type="xml">
|
|
<search string="Search history">
|
|
<field name="name"/>
|
|
<group expand="0" string="Group By...">
|
|
<filter name="group_by_channel" string="Channel" domain="[]" context="{'group_by':'livechat_channel_id'}"/>
|
|
<separator orientation="vertical"/>
|
|
<filter name="group_by_month" string="Creation Date" domain="[]" context="{'group_by':'create_date:month'}"/>
|
|
</group>
|
|
</search>
|
|
</field>
|
|
</record>
|
|
|
|
<record id="mail_channel_view_tree" model="ir.ui.view">
|
|
<field name="name">mail.channel.tree</field>
|
|
<field name="model">mail.channel</field>
|
|
<field name="arch" type="xml">
|
|
<tree string="History" create="false" default_order="create_date desc">
|
|
<field name="create_date" string="Session Date"/>
|
|
<field name="name" string="Attendees"/>
|
|
<field name="channel_message_ids" string="# Messages"/>
|
|
<field name="rating_last_image" string="Rating" widget="image" options='{"size": [20, 20]}'/>
|
|
</tree>
|
|
</field>
|
|
</record>
|
|
|
|
<record id="mail_channel_view_form" model="ir.ui.view">
|
|
<field name="name">mail.channel.form</field>
|
|
<field name="model">mail.channel</field>
|
|
<field name="arch" type="xml">
|
|
<form string="Session Form" create="false" edit="false">
|
|
<sheet>
|
|
<div style="width:50%" class="float-right">
|
|
<field name="rating_last_image" widget="image" class="float-right" readonly="1" nolabel="1"/>
|
|
<field name="rating_last_feedback" nolabel="1"/>
|
|
</div>
|
|
<div style="width:50%" class="float-left">
|
|
<group>
|
|
<field name="name" string="Attendees"/>
|
|
<field name="create_date" readonly="1" string="Session Date"/>
|
|
</group>
|
|
</div>
|
|
|
|
<group string="History" class="o_history_container">
|
|
<div class="o_history_kanban_container">
|
|
<div class="o_history_kanban_sub_container">
|
|
<field name="message_ids" mode="kanban">
|
|
<kanban default_order="create_date DESC">
|
|
<field name="author_id"/>
|
|
<field name="body"/>
|
|
<field name="create_date" groups="base.group_no_one"/>
|
|
<field name="id"/>
|
|
<field name="author_avatar"/>
|
|
<templates>
|
|
<t t-name="kanban-box">
|
|
<div class="oe_module_vignette">
|
|
<div class="o_kanban_image">
|
|
<div>
|
|
<t t-if="record.author_avatar.raw_value">
|
|
<img t-att-src="kanban_image('mail.message', 'author_avatar', record.id.raw_value)" alt="Avatar" class="o_image_64_cover rounded-circle"/>
|
|
</t>
|
|
<t t-else=""><img alt="Anonymous" src="/mail/static/src/img/smiley/avatar.jpg" class="o_image_64_cover rounded-circle"/></t>
|
|
</div>
|
|
</div>
|
|
<div class="oe_module_desc">
|
|
<div class="float-right"><p><field name="date"/></p></div>
|
|
<div>
|
|
<p><strong>
|
|
<t t-if="record.author_id.raw_value"><field name="author_id"/></t>
|
|
<t t-else="">Anonymous</t>
|
|
</strong></p>
|
|
<p>
|
|
<t t-if="record.body.raw_value"><field name="body" widget="html"/><br/></t>
|
|
</p>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
</t>
|
|
</templates>
|
|
</kanban>
|
|
</field>
|
|
</div>
|
|
</div>
|
|
</group>
|
|
</sheet>
|
|
</form>
|
|
</field>
|
|
</record>
|
|
|
|
|
|
<record id="mail_channel_action" model="ir.actions.act_window">
|
|
<field name="name">History</field>
|
|
<field name="res_model">mail.channel</field>
|
|
<field name="view_mode">tree,form</field>
|
|
<field name="search_view_id" ref="im_livechat.mail_channel_view_search"/>
|
|
<field name="domain">[('livechat_channel_id', '!=', None)]</field>
|
|
<field name="context">{'search_default_session_not_empty': 1}</field>
|
|
<field name="help" type="html">
|
|
<p class="o_view_nocontent_empty_folder">
|
|
Your chatter history is empty
|
|
</p><p>
|
|
Create a channel and start chatting to fill up your history.
|
|
</p>
|
|
</field>
|
|
</record>
|
|
<record id="mail_channel_action_tree" model="ir.actions.act_window.view">
|
|
<field name="sequence">1</field>
|
|
<field name="view_mode">tree</field>
|
|
<field name="view_id" ref="im_livechat.mail_channel_view_tree"/>
|
|
<field name="act_window_id" ref="im_livechat.mail_channel_action"/>
|
|
</record>
|
|
|
|
<record id="mail_channel_action_form" model="ir.actions.act_window.view">
|
|
<field name="sequence">2</field>
|
|
<field name="view_mode">form</field>
|
|
<field name="view_id" ref="im_livechat.mail_channel_view_form"/>
|
|
<field name="act_window_id" ref="im_livechat.mail_channel_action"/>
|
|
</record>
|
|
|
|
|
|
<record id="mail_channel_action_from_livechat_channel" model="ir.actions.act_window">
|
|
<field name="name">Sessions</field>
|
|
<field name="res_model">mail.channel</field>
|
|
<field name="view_mode">tree,form</field>
|
|
<field name="domain">[('livechat_channel_id', 'in', [active_id]), ('channel_message_ids', '!=', False)]</field>
|
|
<field name="context">{
|
|
'search_default_livechat_channel_id': [active_id],
|
|
'default_livechat_channel_id': active_id,
|
|
}</field>
|
|
<field name="search_view_id" ref="mail_channel_view_search"/>
|
|
</record>
|
|
<record id="mail_channel_action_livechat_tree" model="ir.actions.act_window.view">
|
|
<field name="sequence">1</field>
|
|
<field name="view_mode">tree</field>
|
|
<field name="view_id" ref="im_livechat.mail_channel_view_tree"/>
|
|
<field name="act_window_id" ref="im_livechat.mail_channel_action_from_livechat_channel"/>
|
|
</record>
|
|
|
|
<record id="mail_channel_action_livechat_form" model="ir.actions.act_window.view">
|
|
<field name="sequence">2</field>
|
|
<field name="view_mode">form</field>
|
|
<field name="view_id" ref="im_livechat.mail_channel_view_form"/>
|
|
<field name="act_window_id" ref="im_livechat.mail_channel_action_from_livechat_channel"/>
|
|
</record>
|
|
|
|
|
|
</data>
|
|
</odoo>
|