Author: |
IT Projects Labs, Ivan Yelizariev |
License: |
Other OSI approved licence |
Branch: |
16.0 |
Repository: |
brain-tec/sync-addons |
Dependencies: |
mail |
Languages: |
JavaScript (177, 35.0%),
Python (203, 40.1%),
XML (67, 13.2%),
and
reStructuredText (59, 11.7%) |
Other branches: |
13.0,
13.0-exodus-17,
13.0-exodus-19,
14.0,
14.0-exodus-17,
14.0-exodus-19,
15.0,
15.0-sync_odoo2odoo,
15.0-sync_telegram,
and
15.0-sync_viber |
Other repositories: |
SeuMarco/sync-addons,
em230418/sync-addons,
itpp-labs/sync-addons,
trojikman/sync-addons,
and
yelizariev/sync-addons |
<a class="reference external image-reference" href="https://itpp.dev"><img alt="Tested and maintained by IT Projects Labs" src="https://itpp.dev/images/infinity-readme.png" /></a>
<a class="reference external image-reference" href="https://opensource.org/licenses/MIT"><img alt="License: MIT" src="https://img.shields.io/badge/license-MIT-blue.svg">
</a>
<a name="customer-chat"></a>
<h2>Customer Chat</h2>
<p>Base module to implement Live Chat through different channels (Telegram, WhatsApp, Instragram, etc.).</p>
<a name="usage"></a>
<h3>Usage</h3>
<p>Add following code to your module. Replace MODULE and NAME for your custom values, e.g.</p>
<ul class="simple">
<li><cite>MODULE</cite> is <cite>sync_telegram</cite></li>
<li><cite>NAME</cite> is <cite>telegram</cite></li>
</ul>
<a name="module-manifest-py"></a>
<h4>MODULE/__manifest__.py</h4>
<pre>
<code lang="py">"depends": ["multi_livechat"],
"assets": {
"web.assets_backend": [
"MODULE/static/src/models/discuss/discuss.js",
"MODULE/static/src/models/discuss_sidebar_category/discuss_sidebar_category.js",
],
},</code>
</pre>
<a name="module-models-init-py"></a>
<h4>MODULE/models/__init__.py</h4>
<pre>
<code lang="py">from . import res_users_settings
from . import mail_channel</code>
</pre>
<a name="module-models-res-users-settings-py"></a>
<h4>MODULE/models/res_users_settings.py</h4>
<pre>
<code lang="py">from odoo import fields, models
class ResUsersSettings(models.Model):
_inherit = 'res.users.settings'
is_discuss_sidebar_category_NAME_open = fields.Boolean("Is category NAME open", default=True)</code>
</pre>
<a name="module-models-mail-channel-py"></a>
<h4>MODULE/models/mail_channel.py</h4>
<pre>
<code lang="py">from odoo import fields, models
class MailChannel(models.Model):
_inherit = "mail.channel"
channel_type = fields.Selection(
selection_add=[("multi_livechat_NAME", "Channel Description")],
ondelete={"multi_livechat_NAME": "cascade"}
)</code>
</pre>
<a name="module-static-src-models-discuss-js"></a>
<h4>MODULE/static/src/models/discuss.js</h4>
<pre>
<code lang="js">/** @odoo-module **/
import { registerPatch } from '@mail/model/model_core';
import { one } from '@mail/model/model_field';
registerPatch({
name: 'Discuss',
fields: {
categoryMLChat_echo_demo: one('DiscussSidebarCategory', {
default: {},
inverse: 'discussAsMLChat_NAME',
}),
},
});</code>
</pre>
<a name="module-static-src-models-discuss-sidebar-category-js"></a>
<h4>MODULE/static/src/models/discuss_sidebar_category.js</h4>
<pre>
<code lang="js">/** @odoo-module **/
import { registerPatch } from '@mail/model/model_core';
import { one } from '@mail/model/model_field';
import { clear } from '@mail/model/model_field_command';
registerPatch({
name: 'DiscussSidebarCategory',
fields: {
categoryItemsOrderedByLastAction: {
compute() {
if (this.discussAsMLChat_NAME) {
return this.categoryItems;
}
return this._super();
},
},
discussAsMLChat_NAME: one('Discuss', {
identifying: true,
inverse: 'categoryMLChat_NAME',
}),
isServerOpen: {
compute() {
// there is no server state for non-users (guests)
if (!this.messaging.currentUser) {
return clear();
}
if (!this.messaging.currentUser.res_users_settings_id) {
return clear();
}
if (this.discussAsMLChat_NAME) {
return this.messaging.currentUser.res_users_settings_id.is_discuss_sidebar_category_NAME_open;
}
return this._super();
},
},
name: {
compute() {
if (this.discussAsMLChat_NAME) {
return this.env._t("NAME");
}
return this._super();
},
},
orderedCategoryItems: {
compute() {
if (this.discussAsMLChat_NAME) {
return this.categoryItemsOrderedByLastAction;
}
return this._super();
},
},
serverStateKey: {
compute() {
if (this.discussAsMLChat_NAME) {
return 'is_discuss_sidebar_category_NAME_open';
}
return this._super();
},
},
supportedChannelTypes: {
compute() {
if (this.discussAsMLChat_NAME) {
return ['NAME'];
}
return this._super();
},
},
},
});</code>
</pre>
<a name="questions"></a>
<h3>Questions?</h3>
<p>To get an assistance on this module contact us by email :arrow_right: <a class="reference external" href="mailto:help@itpp.dev">help@itpp.dev</a></p>
<a name="further-information"></a>
<h3>Further information</h3>
<p>Apps store: <a class="reference external" href="https://apps.odoo.com/apps/modules/16.0/multi_livechat/">https://apps.odoo.com/apps/modules/16.0/multi_livechat/</a></p>
<p>Notifications on updates: <a class="reference external" href="https://github.com/itpp-labs/sync-addons/commits/16.0/multi_livechat.atom">via Atom</a>, <a class="reference external" href="https://blogtrottr.com/?subscribe=https://github.com/itpp-labs/sync-addons/commits/16.0/multi_livechat.atom">by Email</a></p>
<p>Tested on <a class="reference external" href="https://github.com/odoo/odoo/commit/9917d841fa38ccc1e6d67875a665494dc22ef92f">Odoo 16.0</a></p>