Initial commit: Mail packages

This commit is contained in:
Ernad Husremovic 2025-08-29 15:20:51 +02:00
commit 4e53507711
1948 changed files with 751201 additions and 0 deletions

View file

@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8" ?>
<odoo><data>
<record id="chatbot_script_answer_view_form" model="ir.ui.view">
<field name="name">chatbot.script.answer.view.form</field>
<field name="model">chatbot.script.answer</field>
<field name="arch" type="xml">
<form>
<sheet>
<group>
<field name="name"/>
<field name="script_step_id" invisible="1"/>
</group>
</sheet>
</form>
</field>
</record>
<record id="chatbot_script_answer_view_tree" model="ir.ui.view">
<field name="name">chatbot.script.answer.view.tree</field>
<field name="model">chatbot.script.answer</field>
<field name="arch" type="xml">
<tree editable="bottom">
<field name="sequence" widget="handle"/>
<field name="script_step_id"/>
<field name="name"/>
<field name="redirect_link" string="Optional Link"/>
</tree>
</field>
</record>
</data></odoo>

View file

@ -0,0 +1,62 @@
<?xml version="1.0" encoding="UTF-8" ?>
<odoo><data>
<record id="chatbot_script_step_view_form" model="ir.ui.view">
<field name="name">chatbot.script.step.view.form</field>
<field name="model">chatbot.script.step</field>
<field name="arch" type="xml">
<form disable_autofocus="1">
<field name="is_forward_operator_child" invisible="1"/>
<div class="alert alert-info text-center mb-0" role="alert" attrs="{'invisible': [('is_forward_operator_child', '=', False)]}">
<span>Reminder: This step will only be played if no operator is available.</span>
</div>
<div class="alert alert-info text-center mb-0" role="alert" attrs="{'invisible': [('step_type', '!=', 'forward_operator')]}">
<span>Tip: Plan further steps for the Bot in case no operator is available.</span>
</div>
<sheet>
<group>
<group>
<field name="sequence" invisible="1"/>
<field name="message" widget="text_emojis" placeholder="e.g. 'How can I help you?'"
attrs="{'required': [('step_type', '!=', 'forward_operator')]}"/>
<field name="chatbot_script_id" invisible="1"/>
<field name="step_type"/>
<field name="triggering_answer_ids" widget="chatbot_triggering_answers_widget"
options="{'no_create': True}">
<tree>
<!-- added only to correctly fetch the display_name for the tag display -->
<field name="display_name" invisible="1"/>
</tree>
</field>
</group>
<group>
<field name="answer_ids" attrs="{'invisible': [('step_type', '!=', 'question_selection')]}" nolabel="1" colspan="2">
<tree editable="bottom">
<field name="sequence" widget="handle"/>
<field name="display_name" invisible="1"/>
<field name="name"/>
<field name="redirect_link" string="Optional Link"/>
</tree>
</field>
</group>
</group>
</sheet>
</form>
</field>
</record>
<record id="chatbot_script_step_view_tree" model="ir.ui.view">
<field name="name">chatbot.script.step.view.tree</field>
<field name="model">chatbot.script.step</field>
<field name="arch" type="xml">
<tree default_order="sequence asc">
<field name="sequence" widget="handle"/>
<field name="message"/>
<field name="step_type"/>
<field name="answer_ids" widget="many2many_tags"/>
<field name="triggering_answer_ids" widget="many2many_tags"/>
</tree>
</field>
</record>
</data></odoo>

View file

@ -0,0 +1,80 @@
<?xml version="1.0" encoding="UTF-8" ?>
<odoo><data>
<record id="chatbot_script_view_form" model="ir.ui.view">
<field name="name">chatbot.script.view.form</field>
<field name="model">chatbot.script</field>
<field name="arch" type="xml">
<form>
<header>
</header>
<field name="first_step_warning" invisible="1"/>
<div class="alert alert-info text-center" role="alert"
attrs="{'invisible': [('first_step_warning', '!=', 'first_step_operator')]}">
<span>Tip: At least one interaction (Question, Email, ...) is needed before the Bot can perform more complex actions (Forward to an Operator, ...). </span>
<span>Use Channel Rules if you want the Bot to interact with visitors only when no operator is available.</span>
</div>
<div class="alert alert-info text-center" role="alert"
attrs="{'invisible': [('first_step_warning', '!=', 'first_step_invalid')]}">
<span>Tip: At least one interaction (Question, Email, ...) is needed before the Bot can perform more complex actions (Forward to an Operator, ...).</span>
</div>
<sheet>
<div class="oe_button_box" name="button_box">
<button name="action_view_livechat_channels" type="object" class="oe_stat_button"
icon="fa-comments" attrs="{'invisible': [('livechat_channel_count', '=', 0)]}">
<field name="livechat_channel_count" string="Channels" widget="statinfo"/>
</button>
</div>
<field name="active" invisible="1"/>
<widget name="web_ribbon" title="Archived" bg_color="bg-danger" attrs="{'invisible': [('active', '=', True)]}"/>
<field name="image_1920" widget="image" class="oe_avatar" options="{'preview_image': 'image_128'}"/>
<div class="oe_title">
<label for="title" string="Chatbot Name"/>
<h1><field name="title" default_focus="1" placeholder='e.g. "Meeting Scheduler Bot"'/></h1>
</div>
<notebook>
<page string="Script">
<field name="script_step_ids" widget="chatbot_steps_one2many" nolabel="1"
context="{'chatbot_script_answer_display_short_name': 1}"/>
</page>
</notebook>
</sheet>
</form>
</field>
</record>
<record id="chatbot_script_view_tree" model="ir.ui.view">
<field name="name">chatbot.script.view.tree</field>
<field name="model">chatbot.script</field>
<field name="arch" type="xml">
<tree sample="1">
<field name="title"/>
</tree>
</field>
</record>
<record id="chatbot_script_view_search" model="ir.ui.view">
<field name="name">chatbot.script.view.search</field>
<field name="model">chatbot.script</field>
<field name="arch" type="xml">
<search>
<field name="title" string="Name" filter_domain="[('title', 'ilike', self)]"/>
<filter string="Archived" name="inactive" domain="[('active', '=', False)]"/>
</search>
</field>
</record>
<record id="chatbot_script_action" model="ir.actions.act_window">
<field name="name">Chatbot</field>
<field name="res_model">chatbot.script</field>
<field name="view_mode">tree,form</field>
<field name="help" type="html">
<p class="o_view_nocontent_smiling_face">
Create a Chatbot
</p><p>
You can create a new Chatbot with a defined script to speak to your website visitors.
</p>
</field>
</record>
</data></odoo>

View file

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="im_livechat.digest_digest_view_form_inherit" model="ir.ui.view">
<field name="name">im.livechat.digest.digest.view.form.inherit</field>
<field name="model">digest.digest</field>
<field name="priority">80</field>
<field name="inherit_id" ref="digest.digest_digest_view_form" />
<field name="arch" type="xml">
<xpath expr="//group[@name='kpis']/group[last()]" position="before">
<group name="kpi_im_livechat" string="Live Chat">
<field name="kpi_livechat_rating"/>
<field name="kpi_livechat_conversations"/>
<field name="kpi_livechat_response"/>
</group>
</xpath>
</field>
</record>
</odoo>

View file

@ -0,0 +1,110 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data>
<!--
Integrate Livechat Conversation in the Discuss
-->
<!--
Template rendering the external HTML support page
-->
<template id="support_page" name="Livechat : Support Page">
&lt;!DOCTYPE html&gt;
<html style="height: 100%">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title><t t-esc="channel_name"/> Livechat Support Page</title>
<!-- Call the external Bundle to render the css, js, and js loader tags -->
<t t-out="channel.script_external"/>
<style type="text/css">
body {
height: 100%;
font-size: 16px;
font-weight: 400;
font-family: "Lato", "Lucida Grande", "Helvetica neue", "Helvetica", "Verdana", "Arial", sans-serif;
overflow: hidden;
overflow-y: auto;
display: block;
margin: 0;
padding: 0;
border: none;
width: 100%;
height: 100%;
background: #C9C8E0;
background-image: -webkit-linear-gradient(top, #7c7bad, #ddddee);
background-image: -moz-linear-gradient(top, #7c7bad, #ddddee);
background-image: -ms-linear-gradient(top, #7c7bad, #ddddee);
background-image: -o-linear-gradient(top, #7c7bad, #ddddee);
background-image: linear-gradient(to bottom, #7c7bad, #ddddee);
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#7c7bad', endColorstr='#ddddee',GradientType=0 );
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
background-repeat: no-repeat;
background-attachment: fixed;
}
.main {
position: absolute;
opacity: 0;
top: 50%;
width: 100%;
margin-top: -150px;
color: white;
text-shadow: 0 1px 0 rgba(34, 52, 72, 0.2);
text-align: center;
}
.channel_name {
font-size: clamp(2.5rem, 6vw, 3.5rem);
overflow-wrap: break-word;
}
.main div {
font-style: italic;
font-size: 1rem;
}
</style>
</head>
<body>
<div class="main" style="opacity: 1;">
<h1 class="channel_name"><t t-esc="channel.name"/></h1>
<div>Website Live Chat Powered by <strong>Odoo</strong>.</div>
</div>
</body>
</html>
</template>
<!--
Template rendering all the scripts required to execute the Livechat from an external page (which not contain Odoo)
-->
<template id="external_loader" name="Livechat : external_script field of livechat channel">
<!-- css style -->
<link t-attf-href="{{url}}/im_livechat/external_lib.css" rel="stylesheet"/>
<!-- js of all the required lib (internal and external) -->
<script t-attf-src="{{url}}/im_livechat/external_lib.js" type="text/javascript" />
<!-- the loader -->
<script t-attf-src="{{url}}/im_livechat/loader/{{channel_id}}" type="text/javascript"/>
</template>
<!-- the js code to initialize the LiveSupport object -->
<template id="loader" name="Livechat : Javascript appending the livechat button">
<t t-translation="off">
window.addEventListener('load', function () {
odoo.define('im_livechat.loaderData', function() {
return {
isAvailable: <t t-out="'true' if info['available'] else 'false'"/>,
serverUrl: "<t t-out="info['server_url']"/>",
options: <t t-out="json.dumps(info.get('options', {}))"/>,
};
});
});
</t>
</template>
</data>
</odoo>

View file

@ -0,0 +1,336 @@
<?xml version="1.0"?>
<odoo>
<data>
<record id="im_livechat_channel_action" model="ir.actions.act_window">
<field name="name">Website Live Chat Channels</field>
<field name="res_model">im_livechat.channel</field>
<field name="view_mode">kanban,form</field>
<field name="help" type="html">
<p class="o_view_nocontent_smiling_face">
Define a new website live chat channel
</p><p>
You can create channels for each website on which you want
to integrate the website live chat widget, allowing your website
visitors to talk in real time with your operators.
</p>
</field>
</record>
<record id="im_livechat_channel_view_kanban" model="ir.ui.view">
<field name="name">im_livechat.channel.kanban</field>
<field name="model">im_livechat.channel</field>
<field name="arch" type="xml">
<kanban>
<field name="id"/>
<field name="name"/>
<field name="web_page" widget="url"/>
<field name="are_you_inside"/>
<field name="user_ids"/>
<field name="nbr_channel"/>
<field name="rating_percentage_satisfaction"/>
<field name="rating_count"/>
<templates>
<t t-name="kanban-box">
<div class="oe_kanban_global_click">
<div class="o_kanban_image">
<img t-att-src="kanban_image('im_livechat.channel', 'image_128', record.id.raw_value)" class="img-fluid" alt="Channel"/>
</div>
<div class="oe_kanban_details">
<div class="float-end">
<button t-if="record.are_you_inside.raw_value" name="action_quit" type="object" class="btn btn-primary">Leave</button>
<button t-if="!record.are_you_inside.raw_value" name="action_join" type="object" class="btn btn-primary">Join</button>
</div>
<strong class="o_kanban_record_title" style="word-wrap: break-word;"><field name="name"/></strong>
<div>
<div>
<i class="fa fa-user" role="img" aria-label="User" title="User"></i> <t t-esc="(record.user_ids.raw_value || []).length"/> Operators
<br/>
<i class="fa fa-comments" role="img" aria-label="Comments" title="Comments"></i> <t t-esc="record.nbr_channel.raw_value"/> Sessions
<div t-if="record.rating_count.raw_value &gt; 0" class="float-end">
<a name="action_view_rating" type="object" tabindex="10">
<i class="fa fa-smile-o text-success" title="Percentage of happy ratings" role="img" aria-label="Happy face"/> <t t-esc="record.rating_percentage_satisfaction.raw_value"/>%
</a>
</div>
</div>
</div>
</div>
</div>
</t>
</templates>
</kanban>
</field>
</record>
<record id="im_livechat_channel_view_form" model="ir.ui.view">
<field name="name">im_livechat.channel.form</field>
<field name="model">im_livechat.channel</field>
<field name="arch" type="xml">
<form>
<header>
<button type="object" name="action_join" class="oe_highlight" string="Join Channel" attrs='{"invisible": [["are_you_inside", "=", True]]}'/>
<button type="object" name="action_quit" string="Leave Channel" attrs='{"invisible": [["are_you_inside", "=", False]]}'/>
<field name="are_you_inside" invisible="1"/>
</header>
<sheet>
<field name="rating_count" invisible="1"/>
<div class="oe_button_box" name="button_box">
<button class="oe_stat_button" type="object" name="action_view_chatbot_scripts" icon="fa-android"
attrs="{'invisible': [('chatbot_script_count', '=', 0)]}">
<field string="Chatbots" name="chatbot_script_count" widget="statinfo"/>
</button>
<button class="oe_stat_button" type="action" attrs="{'invisible':[('nbr_channel','=', 0)]}" name="%(mail_channel_action_from_livechat_channel)d" icon="fa-comments">
<field string="Sessions" name="nbr_channel" widget="statinfo"/>
</button>
<button name="action_view_rating" attrs="{'invisible':[('rating_count', '=', 0)]}" class="oe_stat_button" type="object" icon="fa-smile-o">
<field string="% Happy" name="rating_percentage_satisfaction" widget="statinfo"/>
</button>
</div>
<field name="image_128" widget="image" class="oe_avatar"/>
<div class="oe_title">
<label for="name"/>
<h1>
<field name="name" placeholder="e.g. YourWebsite.com"/>
</h1>
</div>
<notebook>
<page string="Operators" name="operators">
<field name="user_ids" nolabel="1" colspan="2" domain="[['groups_id', 'not in', %(base.group_portal)d]]">
<kanban>
<field name="id"/>
<field name="name"/>
<templates>
<t t-name="kanban-box">
<div class="oe_kanban_global_click">
<div class="o_kanban_image">
<img t-att-src="kanban_image('res.users', 'avatar_1024', record.id.raw_value)" alt="User"/>
</div>
<div class="o_kanban_details">
<h4 class="o_kanban_record_title"><field name="name"/></h4>
</div>
</div>
</t>
</templates>
</kanban>
</field>
<p class="text-muted" colspan="2">
Operators that do not show any activity In Odoo for more than 30 minutes will be considered as disconnected.
</p>
</page>
<page string="Options" name="options">
<group>
<group string="Livechat Button">
<field name="button_text"/>
<label for="button_background_color" string="Livechat Button Color" />
<div class="o_livechat_layout_colors d-flex align-items-center align-middle">
<field name="button_background_color" widget="color" class="mb-4 w-auto o_im_livechat_field_widget_color"/>
<field name="button_text_color" widget="color" class="mb-4 w-auto o_im_livechat_field_widget_color"/>
<widget name="colors_reset_button" options="{'default_colors': {'button_background_color': '#878787', 'button_text_color': '#FFFFFF'}}" />
</div>
</group>
<group string="Livechat Window">
<field name="default_message" placeholder="e.g. Hello, how may I help you?"/>
<field name="input_placeholder"/>
<label for="header_background_color" string="Channel Header Color" />
<div class="o_livechat_layout_colors d-flex align-items-center align-middle">
<field name="header_background_color" widget="color" class="mb-4 w-auto o_im_livechat_field_widget_color"/>
<field name="title_color" widget="color" class="mb-4 w-auto o_im_livechat_field_widget_color"/>
<widget name="colors_reset_button" options="{'default_colors': {'header_background_color': '#875A7B', 'title_color': '#FFFFFF'}}" />
</div>
</group>
</group>
</page>
<page string="Channel Rules" name="channel_rules">
<field name="rule_ids" colspan="2"/>
<div class="text-muted" colspan="2">Define rules for your live support channel. You can apply an action for the given URL, and per country.<br />To identify the country, GeoIP must be installed on your server, otherwise, the countries of the rule will not be taken into account.</div>
</page>
<page string="Widget" name="configuration_widget">
<div class="alert alert-warning mt4 mb16" role="alert" attrs='{"invisible": [["web_page", "!=", False]]}'>
Save your Channel to get your configuration widget.
</div>
<div attrs='{"invisible": [["web_page", "=", False]]}'>
<separator string="How to use the Website Live Chat widget?"/>
<p>
Copy and paste this code into your website, within the &lt;head&gt; tag:
</p>
<field name="script_external" readonly="1" widget="CopyClipboardText"/>
<p>
or copy this url and send it by email to your customers or suppliers:
</p>
<field name="web_page" readonly="1" widget="CopyClipboardChar"/>
<p>For websites built with the Odoo CMS, go to Website > Configuration > Settings and select the Website Live Chat Channel you want to add to your website.</p>
</div>
</page>
</notebook>
</sheet>
</form>
</field>
</record>
<record id="im_livechat_channel_view_search" model="ir.ui.view">
<field name="name">im.livechat.channel.view.search</field>
<field name="model">im_livechat.channel</field>
<field name="arch" type="xml">
<search string="LiveChat Channel Search">
<field name="name" string="Channel"/>
</search>
</field>
</record>
<!-- im_livechat.channel.rule -->
<record id="im_livechat_channel_rule_view_tree" model="ir.ui.view">
<field name="name">im.livechat.channel.rule.tree</field>
<field name="model">im_livechat.channel.rule</field>
<field name="arch" type="xml">
<tree string="Rules">
<field name="sequence" widget="handle"/>
<field name="regex_url"/>
<field name="action"/>
<field name="country_ids" widget="many2many_tags"/>
</tree>
</field>
</record>
<record id="im_livechat_channel_rule_view_kanban" model="ir.ui.view">
<field name="name">im_livechat.channel.rule.kanban</field>
<field name="model">im_livechat.channel.rule</field>
<field name="arch" type="xml">
<kanban>
<field name="regex_url"/>
<field name="action"/>
<field name="country_ids"/>
<templates>
<t t-name="kanban-box">
<div class="oe_kanban_global_click">
<div><field name="action"/></div>
<field name="regex_url" />
<field name="country_ids" widget="many2many_tags" />
</div>
</t>
</templates>
</kanban>
</field>
</record>
<record id="im_livechat_channel_rule_view_form" model="ir.ui.view">
<field name="name">im_livechat.channel.rule.form</field>
<field name="model">im_livechat.channel.rule</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Channel Rule" class="o_livechat_rules_form">
<sheet>
<group>
<field name="action" widget="radio"/>
<label for="chatbot_script_id" string="Chatbot" attrs="{'invisible': [('action', '=', 'hide_button')]}"/>
<div attrs="{'invisible': [('action', '=', 'hide_button')]}">
<field name="chatbot_script_id" class="oe_inline" style="width: 60% !important;"
options="{'no_create': True, 'no_open': True}"/>
</div>
<label for="chatbot_only_if_no_operator" class="oe_inline" attrs="{'invisible': [('chatbot_script_id', '=', False)]}" string="Enabled only if no operator"/>
<div class="oe_inline" attrs="{'invisible': [('chatbot_script_id', '=', False)]}">
<field name="chatbot_only_if_no_operator"/>
</div>
<field name="regex_url" placeholder="e.g. /contactus"/>
<label for="auto_popup_timer" class="oe_inline" attrs="{'invisible': [('action', '!=', 'auto_popup')]}"/>
<div class="oe_inline" attrs="{'invisible': [('action', '!=', 'auto_popup')]}">
<field name="auto_popup_timer" class="oe_inline"/> seconds
</div>
<field name="country_ids" widget="many2many_tags" options="{'no_open': True, 'no_create': True}"/>
</group>
</sheet>
</form>
</field>
</record>
<!-- Canned responses -->
<record id="im_livechat_canned_response_view_tree" model="ir.ui.view">
<field name="name">im_livechat.canned_response.tree</field>
<field name="model">mail.shortcode</field>
<field name="arch" type="xml">
<tree editable="bottom">
<field name="source"/>
<field name="substitution"/>
</tree>
</field>
</record>
<record id="im_livechat_canned_response_action" model="ir.actions.act_window">
<field name="name">Canned Responses</field>
<field name="res_model">mail.shortcode</field>
<field name="view_mode">tree</field>
<field name="view_id" ref="im_livechat_canned_response_view_tree"/>
<field name="domain">[]</field>
<field name="help" type="html">
<p class="o_view_nocontent_smiling_face">
Create a new canned response
</p><p>
Canned responses allow you to insert prewritten responses in
your messages by typing <i>:shortcut</i>. The shortcut is
replaced directly in your message, so that you can still edit
it before sending.
</p>
</field>
</record>
<!-- Menu items -->
<menuitem
id="menu_livechat_root"
name="Live Chat"
web_icon="im_livechat,static/description/icon.svg"
groups="im_livechat_group_user"
sequence="240"/>
<menuitem
id="support_channels"
name="Channels"
parent="menu_livechat_root"
action="im_livechat_channel_action"
groups="im_livechat_group_user"
sequence="5"/>
<menuitem
id="menu_reporting_livechat"
name="Report"
parent="menu_livechat_root"
sequence="50"
groups="im_livechat_group_manager"/>
<menuitem
id="session_history"
name="Sessions History"
parent="menu_reporting_livechat"
action="mail_channel_action"
groups="im_livechat_group_user"
sequence="5"/>
<menuitem id="rating_rating_menu_livechat"
name="Customer Ratings"
action="rating_rating_action_livechat_report"
parent="menu_reporting_livechat"
sequence="40"/>
<menuitem
id="livechat_config"
name="Configuration"
parent="menu_livechat_root"
sequence="55"/>
<menuitem
id="canned_responses"
name="Canned Responses"
parent="livechat_config"
action="im_livechat_canned_response_action"
groups="im_livechat_group_user"
sequence="15"/>
<menuitem
id="chatbot_config"
name="Chatbots"
parent="livechat_config"
action="chatbot_script_action"
groups="im_livechat_group_user"
sequence="20"/>
</data>
</odoo>

View file

@ -0,0 +1,30 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data>
<template id="chatbot_test_script_page">
<script>
<t t-call="im_livechat.loader">
<t t-set="info" t-value="{ 'available': True, 'options': { 'isTestChatbot': True, 'testChatbotChannelData': channel_data, 'testChatbotData': chatbot_data }, 'server_url': server_url }"/>
</t>
</script>
<t t-call="web.frontend_layout">
<t t-set="no_livechat" t-value="True"/>
<t t-set="title" t-value="chatbot_data['chatbot_name']"/>
<div id="wrap">
<div groups="im_livechat.im_livechat_group_user" t-ignore="true"
class="alert alert-info alert-dismissible rounded-0 fade show d-print-none css_editable_mode_hidden mb-0">
<div t-ignore="true" class="text-center">
<a t-attf-href="/web#view_type=form&amp;model=chatbot.script&amp;id=#{chatbot_data['chatbot_script_id']}&amp;action=im_livechat.chatbot_script_action">
<span>You are currently testing</span>
<span t-out="chatbot_data['chatbot_name']"/>
<i class="fa fa-fw fa-arrow-right"/>Back to edit mode
</a>
</div>
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
</div>
</div>
</t>
</template>
</data>
</odoo>

View file

@ -0,0 +1,155 @@
<?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="message_ids" string="# Messages"/>
<field name="rating_last_image" string="Rating" widget="image" options='{"size": [20, 20]}' class="bg-view"/>
</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-end">
<field name="rating_last_image" widget="image" class="float-end bg-view" readonly="1" nolabel="1"/>
<field name="rating_last_feedback" nolabel="1"/>
</div>
<div style="width:50%" class="float-start">
<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 w-100 p-3" colspan="2">
<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"/>
<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-end"><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])]</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>

View file

@ -0,0 +1,79 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="rating_rating_view_search_livechat" model="ir.ui.view">
<field name="name">rating.rating.search.livechat</field>
<field name="model">rating.rating</field>
<field name="inherit_id" ref="rating.rating_rating_view_search"/>
<field name="mode">primary</field>
<field name="priority">64</field>
<field name="arch" type="xml">
<xpath expr="//filter[@name='resource']" position="replace">
<filter string="Code" name="resource" context="{'group_by':'res_name'}"/>
</xpath>
<xpath expr="//filter[@name='resource']" position="after">
<filter string="Livechat Channel" name="groupby_livechat_channel" context="{'group_by': 'parent_res_name'}"/>
</xpath>
<xpath expr="/search" position="inside">
<filter string="This Week" name="creation_date_filter" domain="[
('create_date', '>=', (datetime.datetime.combine(context_today() + relativedelta(weeks=-1,days=1,weekday=0), datetime.time(0,0,0)).to_utc()).strftime('%Y-%m-%d %H:%M:%S')),
('create_date', '&lt;', (datetime.datetime.combine(context_today() + relativedelta(days=1,weekday=0), datetime.time(0,0,0)).to_utc()).strftime('%Y-%m-%d %H:%M:%S'))]"/>
</xpath>
</field>
</record>
<record id="rating_rating_action_livechat" model="ir.actions.act_window">
<field name="name">Ratings for livechat channel</field>
<field name="res_model">rating.rating</field>
<field name="view_mode">kanban,tree,graph,pivot,form</field>
<field name="domain">[('parent_res_model', '=', 'im_livechat.channel'), ('consumed','=',True)]</field>
<field name="search_view_id" ref="rating_rating_view_search_livechat"/>
<field name="help" type="html">
<p class="o_view_nocontent_empty_folder">
There is no rating for this channel at the moment
</p>
</field>
<field name="context">{'search_default_rating_last_7_days': 1}</field>
</record>
<record id="rating_rating_action_livechat_view_kanban" model="ir.actions.act_window.view">
<field name="sequence" eval="1"/>
<field name="view_mode">kanban</field>
<field name="act_window_id" ref="rating_rating_action_livechat"/>
<field name="view_id" ref="rating.rating_rating_view_kanban"/>
</record>
<record id="rating_rating_action_livechat_view_form" model="ir.actions.act_window.view">
<field name="sequence">5</field>
<field name="view_mode">form</field>
<field name="act_window_id" ref="rating_rating_action_livechat"/>
<field name="view_id" ref="rating.rating_rating_view_form_text"/>
</record>
<record id="rating_rating_action_livechat_report" model="ir.actions.act_window">
<field name="name">Customer Ratings</field>
<field name="res_model">rating.rating</field>
<field name="view_mode">kanban,tree,pivot,graph,form</field>
<field name="domain">[('parent_res_model','=','im_livechat.channel'), ('consumed', '=', True)]</field>
<field name="search_view_id" ref="rating_rating_view_search_livechat"/>
<field name="help" type="html">
<p class="o_view_nocontent_empty_folder">
No customer ratings on live chat session yet
</p>
</field>
</record>
<record id="rating_rating_action_livechat_report_view_kanban" model="ir.actions.act_window.view">
<field name="sequence">1</field>
<field name="view_mode">kanban</field>
<field name="act_window_id" ref="rating_rating_action_livechat_report"/>
<field name="view_id" ref="rating.rating_rating_view_kanban"/>
</record>
<record id="rating_rating_action_livechat_report_view_form" model="ir.actions.act_window.view">
<field name="sequence">5</field>
<field name="view_mode">form</field>
<field name="act_window_id" ref="rating_rating_action_livechat_report"/>
<field name="view_id" ref="rating.rating_rating_view_form_text"/>
</record>
</odoo>

View file

@ -0,0 +1,34 @@
<?xml version="1.0"?>
<odoo>
<data>
<!-- Update Preferences form !-->
<record id="res_users_form_view_simple_modif" model="ir.ui.view">
<field name="name">res.users.preferences.form.im_livechat</field>
<field name="model">res.users</field>
<field name="inherit_id" ref="base.view_users_form_simple_modif"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='tz']" position="after">
<field name="livechat_username" string="Online Chat Name" readonly="0"
attrs="{'invisible': [('share', '=', True)]}"/>
</xpath>
</field>
</record>
<!-- Update user form !-->
<record id="res_users_form_view" model="ir.ui.view">
<field name="name">res.users.form.im_livechat</field>
<field name="model">res.users</field>
<field name="inherit_id" ref="base.view_users_form"/>
<field name="arch" type="xml">
<xpath expr="//group[@name='messaging']" position="after">
<group name="livechat" string="Livechat"
attrs="{'invisible': [('share', '=', True)]}">
<field name="livechat_username"/>
</group>
</xpath>
</field>
</record>
</data>
</odoo>