summaryrefslogtreecommitdiff
path: root/addons/im_livechat/views
diff options
context:
space:
mode:
authorstephanchrst <stephanchrst@gmail.com>2022-05-10 21:51:50 +0700
committerstephanchrst <stephanchrst@gmail.com>2022-05-10 21:51:50 +0700
commit3751379f1e9a4c215fb6eb898b4ccc67659b9ace (patch)
treea44932296ef4a9b71d5f010906253d8c53727726 /addons/im_livechat/views
parent0a15094050bfde69a06d6eff798e9a8ddf2b8c21 (diff)
initial commit 2
Diffstat (limited to 'addons/im_livechat/views')
-rw-r--r--addons/im_livechat/views/digest_views.xml17
-rw-r--r--addons/im_livechat/views/im_livechat_channel_templates.xml224
-rw-r--r--addons/im_livechat/views/im_livechat_channel_views.xml332
-rw-r--r--addons/im_livechat/views/mail_channel_views.xml155
-rw-r--r--addons/im_livechat/views/rating_views.xml52
-rw-r--r--addons/im_livechat/views/res_users_views.xml32
6 files changed, 812 insertions, 0 deletions
diff --git a/addons/im_livechat/views/digest_views.xml b/addons/im_livechat/views/digest_views.xml
new file mode 100644
index 00000000..4082b295
--- /dev/null
+++ b/addons/im_livechat/views/digest_views.xml
@@ -0,0 +1,17 @@
+<?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="inherit_id" ref="digest.digest_digest_view_form" />
+ <field name="arch" type="xml">
+ <xpath expr="//group[@name='kpi_general']" position="after">
+ <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>
diff --git a/addons/im_livechat/views/im_livechat_channel_templates.xml b/addons/im_livechat/views/im_livechat_channel_templates.xml
new file mode 100644
index 00000000..da4a0a62
--- /dev/null
+++ b/addons/im_livechat/views/im_livechat_channel_templates.xml
@@ -0,0 +1,224 @@
+<?xml version="1.0" encoding="utf-8"?>
+<odoo>
+ <data>
+
+ <!--
+ Integrate Livechat Conversation in the Discuss
+ -->
+ <template id="assets_backend" name="im_livechat assets backend" inherit_id="web.assets_backend">
+ <xpath expr="." position="inside">
+ <script type="text/javascript" src="/im_livechat/static/src/js/im_livechat_channel_form_view.js"></script>
+ <script type="text/javascript" src="/im_livechat/static/src/js/im_livechat_channel_form_controller.js"></script>
+ <script type="text/javascript" src="/im_livechat/static/src/bugfix/bugfix.js"></script>
+ <script type="text/javascript" src="/im_livechat/static/src/components/discuss/discuss.js"></script>
+ <script type="text/javascript" src="/im_livechat/static/src/components/discuss_sidebar/discuss_sidebar.js"></script>
+ <script type="text/javascript" src="/im_livechat/static/src/components/discuss_sidebar_item/discuss_sidebar_item.js"></script>
+ <script type="text/javascript" src="/im_livechat/static/src/components/notification_list/notification_list.js"></script>
+ <script type="text/javascript" src="/im_livechat/static/src/components/thread_needaction_preview/thread_needaction_preview.js"></script>
+ <script type="text/javascript" src="/im_livechat/static/src/components/thread_preview/thread_preview.js"></script>
+ <script type="text/javascript" src="/im_livechat/static/src/models/messaging_initializer/messaging_initializer.js"></script>
+ <script type="text/javascript" src="/im_livechat/static/src/models/messaging_notification_handler/messaging_notification_handler.js"></script>
+ <script type="text/javascript" src="/im_livechat/static/src/models/partner/partner.js"></script>
+ <script type="text/javascript" src="/im_livechat/static/src/models/thread/thread.js"></script>
+ <script type="text/javascript" src="/im_livechat/static/src/widgets/discuss/discuss.js"></script>
+
+ <link rel="stylesheet" type="text/scss" href="/im_livechat/static/src/bugfix/bugfix.scss"/>
+ <link rel="stylesheet" type="text/scss" href="/im_livechat/static/src/scss/im_livechat_history.scss"/>
+ <link rel="stylesheet" type="text/scss" href="/im_livechat/static/src/scss/im_livechat_form.scss"/>
+ </xpath>
+ </template>
+
+ <template id="qunit_suite" name="livechat_tests" inherit_id="web.qunit_suite_tests">
+ <xpath expr="." position="inside">
+ <script type="text/javascript" src="/im_livechat/static/src/bugfix/bugfix_tests.js"></script>
+ <script type="text/javascript" src="/im_livechat/static/src/components/chat_window_manager/chat_window_manager_tests.js"/>
+ <script type="text/javascript" src="/im_livechat/static/src/components/composer/composer_tests.js"></script>
+ <script type="text/javascript" src="/im_livechat/static/src/components/discuss/discuss_tests.js"></script>
+ <script type="text/javascript" src="/im_livechat/static/src/components/messaging_menu/messaging_menu_tests.js"/>
+ <script type="text/javascript" src="/im_livechat/static/src/components/thread_icon/thread_icon_tests.js"></script>
+ <script type="text/javascript" src="/im_livechat/static/src/components/thread_textual_typing_status/thread_textual_typing_status_tests.js"></script>
+ <script type="text/javascript" src="/im_livechat/static/src/legacy/public_livechat.js"></script>
+ <script type="text/javascript" src="/im_livechat/static/tests/helpers/mock_models.js"></script>
+ <script type="text/javascript" src="/im_livechat/static/tests/helpers/mock_server.js"></script>
+ </xpath>
+ </template>
+
+ <!--
+ 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" />
+ <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-raw="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;
+ }
+ .main h1 {
+ font-size: 54px;
+ }
+ .main div {
+ font-style: italic;
+ }
+ </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-att-href="'%s/im_livechat/external_lib.css' % (url)" rel="stylesheet"/>
+ <!-- js of all the required lib (internal and external) -->
+ <script t-att-src="'%s/im_livechat/external_lib.js' % (url)" type="text/javascript" />
+ <!-- the loader -->
+ <script t-att-src="'%s/im_livechat/loader/%i' % (url, channel_id)" type="text/javascript"/>
+ </template>
+
+
+ <!--
+ Bundle of External Librairies of the Livechat (Odoo + required modules)
+ -->
+ <template id="external_lib" name="Livechat : External Librairies of the Livechat, required to make it work">
+ <!-- Momentjs -->
+ <script type="text/javascript" src="/web/static/lib/moment/moment.js"></script>
+ <!-- Odoo minimal lib -->
+ <script type="text/javascript" src="/web/static/lib/underscore/underscore.js"></script>
+ <script type="text/javascript" src="/web/static/lib/underscore.string/lib/underscore.string.js"></script>
+ <!-- jQuery -->
+ <script type="text/javascript" src="/web/static/lib/jquery/jquery.js"></script>
+ <script type="text/javascript" src="/web/static/lib/jquery.ui/jquery-ui.js"></script>
+ <script type="text/javascript" src="/web/static/lib/jquery/jquery.browser.js"></script>
+ <script type="text/javascript" src="/web/static/lib/jquery.ba-bbq/jquery.ba-bbq.js"></script>
+ <!-- Qweb2 lib -->
+ <script type="text/javascript" src="/web/static/lib/qweb/qweb2.js"></script>
+ <!-- Odoo JS Framework -->
+ <script type="text/javascript" src="/web/static/lib/owl/owl.js"></script>
+ <script type="text/javascript" src="/web/static/src/js/promise_extension.js"></script>
+ <script type="text/javascript" src="/web/static/src/js/boot.js"></script>
+ <script type="text/javascript" src="/web/static/src/js/libs/download.js"></script>
+ <script type="text/javascript" src="/web/static/src/js/libs/content-disposition.js"></script>
+ <script type="text/javascript" src="/web/static/src/js/services/config.js"></script>
+ <script type="text/javascript" src="/web/static/src/js/core/abstract_service.js"></script>
+ <script type="text/javascript" src="/web/static/src/js/core/class.js"></script>
+ <script type="text/javascript" src="/web/static/src/js/core/collections.js"/>
+ <script type="text/javascript" src="/web/static/src/js/core/translation.js"></script>
+ <script type="text/javascript" src="/web/static/src/js/core/ajax.js"></script>
+ <script type="text/javascript" src="/im_livechat/static/src/js/ajax_external.js"></script>
+ <script type="text/javascript" src="/web/static/src/js/core/time.js"></script>
+ <script type="text/javascript" src="/web/static/src/js/core/mixins.js"></script>
+ <script type="text/javascript" src="/web/static/src/js/core/service_mixins.js"></script>
+ <script type="text/javascript" src="/web/static/src/js/core/rpc.js"></script>
+ <script type="text/javascript" src="/web/static/src/js/core/widget.js"></script>
+ <script type="text/javascript" src="/web/static/src/js/core/registry.js"></script>
+ <script type="text/javascript" src="/web/static/src/js/core/session.js"></script>
+ <script type="text/javascript" src="/web/static/src/js/core/concurrency.js"></script>
+ <script type="text/javascript" src="/web/static/src/js/core/utils.js"></script>
+ <script type="text/javascript" src="/web/static/src/js/core/dom.js"></script>
+ <script type="text/javascript" src="/web/static/src/js/core/qweb.js"></script>
+ <script type="text/javascript" src="/web/static/src/js/core/bus.js"></script>
+ <script type="text/javascript" src="/web/static/src/js/services/core.js"></script>
+ <script type="text/javascript" src="/web/static/src/js/core/local_storage.js"></script>
+ <script type="text/javascript" src="/web/static/src/js/core/ram_storage.js"></script>
+ <script type="text/javascript" src="/web/static/src/js/core/abstract_storage_service.js"></script>
+ <script type="text/javascript" src="/web/static/src/js/common_env.js"></script>
+ <script type="text/javascript" src="/web/static/src/js/public/lazyloader.js"/>
+ <script type="text/javascript" src="/web/static/src/js/public/public_env.js"/>
+ <script type="text/javascript" src="/web/static/src/js/public/public_root.js"/>
+ <script type="text/javascript" src="/web/static/src/js/public/public_root_instance.js"/>
+ <script type="text/javascript" src="/web/static/src/js/public/public_widget.js"/>
+ <script type="text/javascript" src="/web/static/src/js/services/ajax_service.js"></script>
+ <script type="text/javascript" src="/web/static/src/js/services/local_storage_service.js"></script>
+ <!-- Bus, Mail, Livechat -->
+ <script type="text/javascript" src="/bus/static/src/js/longpolling_bus.js"></script>
+ <script type="text/javascript" src="/bus/static/src/js/crosstab_bus.js"></script>
+ <script type="text/javascript" src="/bus/static/src/js/services/bus_service.js"></script>
+ <script type="text/javascript" src="/mail/static/src/js/utils.js"></script>
+ <script type="text/javascript" src="/im_livechat/static/src/legacy/public_livechat.js"></script>
+ <t t-call="web._assets_helpers"/>
+ <link rel="stylesheet" type="text/scss" href="/im_livechat/static/src/scss/im_livechat_bootstrap.scss"/>
+ <link rel="stylesheet" type="text/scss" href="/im_livechat/static/src/legacy/public_livechat.scss"/>
+ </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 () {
+ <t t-if="web_session_required">
+ odoo.define('web.session', function (require) {
+ var Session = require('web.Session');
+ var modules = odoo._modules;
+ return new Session(undefined, "<t t-esc="info['server_url']"/>", {modules:modules, use_cors: true});
+ });
+ </t>
+
+ odoo.define('im_livechat.livesupport', function (require) {
+ <t t-if="info['available']" t-translation="off">
+ var rootWidget = require('root.widget');
+ var im_livechat = require('im_livechat.legacy.im_livechat.im_livechat');
+ var button = new im_livechat.LivechatButton(
+ rootWidget,
+ "<t t-esc="info['server_url']"/>",
+ <t t-raw="json.dumps(info.get('options', {}))"/>
+ );
+ button.appendTo(document.body);
+ window.livechat_button = button;
+ </t>
+ });
+ });
+ </t>
+ </template>
+
+
+ </data>
+</odoo>
diff --git a/addons/im_livechat/views/im_livechat_channel_views.xml b/addons/im_livechat/views/im_livechat_channel_views.xml
new file mode 100644
index 00000000..72fab109
--- /dev/null
+++ b/addons/im_livechat/views/im_livechat_channel_views.xml
@@ -0,0 +1,332 @@
+<?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"/>
+ <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-right">
+ <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 class="float-right">
+ <t t-if="record.rating_percentage_satisfaction.raw_value &gt; 0">
+ <a type="action" name="%(rating_rating_action_view_livechat_rating)d" tabindex="10">
+ <i class="fa fa-smile-o text-success" t-if="record.rating_percentage_satisfaction.raw_value &gt;= 70" title="Rating: Great" role="img" aria-label="Happy face"/>
+ <i class="fa fa-meh-o text-warning" t-if="record.rating_percentage_satisfaction.raw_value &gt; 30 and record.rating_percentage_satisfaction.raw_value &lt; 70" title="Rating: Okay" role="img" aria-label="Neutral face"/>
+ <i class="fa fa-frown-o text-danger" t-if="record.rating_percentage_satisfaction.raw_value &lt;= 30" title="Rating: Bad" role="img" aria-label="Sad face"/>
+ <t t-esc="record.rating_percentage_satisfaction.raw_value"/>%
+ </a>
+ </t>
+ </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 js_class="im_livechat_channel_form_view_js">
+ <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>
+ <div class="oe_button_box" name="button_box">
+ <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_percentage_satisfaction','=', -1)]}" 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" class="oe_edit_only"/>
+ <h1>
+ <field name="name" placeholder="e.g. YourWebsite.com"/>
+ </h1>
+ </div>
+ <notebook>
+ <page string="Operators" name="operators">
+ <group>
+ <field name="user_ids" nolabel="1" colspan="2">
+ <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', 'image_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" style="padding-left: 8px">
+ Operators that do not show any activity In Odoo for more than 30 minutes will be considered as disconnected.
+ </p>
+ </group>
+ </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">
+ <field name="button_background_color" widget="color" class="mb-4 o_im_livechat_field_widget_color"/>
+ <field name="button_text_color" widget="color" class="mb-4 o_im_livechat_field_widget_color"/>
+ <button class="btn btn-link oe_edit_only o_im_livechat_channel_form_button_colors_reset_button" aria-label="Reset to default colors" title="Reset to default colors">
+ <span class="fa fa-refresh mb-4"/>
+ </button>
+ </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">
+ <field name="header_background_color" widget="color" class="mb-4 o_im_livechat_field_widget_color"/>
+ <field name="title_color" widget="color" class="mb-4 o_im_livechat_field_widget_color"/>
+ <button class="btn btn-link oe_edit_only o_im_livechat_channel_form_chat_window_colors_reset_button" aria-label="Reset to default colors" title="Reset to default colors">
+ <span class="fa fa-refresh mb-4"/>
+ </button>
+ </div>
+ </group>
+ </group>
+ </page>
+ <page string="Channel Rules" name="channel_rules">
+ <span class="text-muted">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.</span>
+ <group>
+ <field name="rule_ids" nolabel="1"/>
+ </group>
+ </page>
+ <page string="Widget" name="configuration_widget">
+ <group attrs='{"invisible": [["web_page", "!=", False]]}'>
+ <div class="alert alert-warning mt4 mb16" role="alert">
+ Save your Channel to get your configuration widget.
+ </div>
+ </group>
+ <group>
+ <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>
+ </group>
+ </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"/>
+ </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"/>
+ <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"/>
+ </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.png"
+ groups="im_livechat_group_user"
+ sequence="205"/>
+
+ <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"/>
+
+ </data>
+</odoo>
diff --git a/addons/im_livechat/views/mail_channel_views.xml b/addons/im_livechat/views/mail_channel_views.xml
new file mode 100644
index 00000000..a9e03b81
--- /dev/null
+++ b/addons/im_livechat/views/mail_channel_views.xml
@@ -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="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>
diff --git a/addons/im_livechat/views/rating_views.xml b/addons/im_livechat/views/rating_views.xml
new file mode 100644
index 00000000..91b8d1a7
--- /dev/null
+++ b/addons/im_livechat/views/rating_views.xml
@@ -0,0 +1,52 @@
+<?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="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">
+ <field name="parent_res_name"/>
+ <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_view_livechat_rating" 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_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>
+
+</odoo>
diff --git a/addons/im_livechat/views/res_users_views.xml b/addons/im_livechat/views/res_users_views.xml
new file mode 100644
index 00000000..0ded2190
--- /dev/null
+++ b/addons/im_livechat/views/res_users_views.xml
@@ -0,0 +1,32 @@
+<?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"/>
+ </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">
+ <field name="livechat_username"/>
+ </group>
+ </xpath>
+ </field>
+ </record>
+
+ </data>
+</odoo>