Skip to content
Permalink
Browse files

[FIX] website_livechat: fix error when no ratings

If there is no rating for user, it will throw error while publishing channel.
This commit check if there is any rating for particular user or not.

Introduced by ce20c29

opw-1966384
  • Loading branch information...
pka-odoo authored and rdeodoo committed Apr 9, 2019
1 parent 9787aba commit c79d171ee9c85698e2c0d5fbe1c12fb67979a32d
Showing with 15 additions and 13 deletions.
  1. +15 −13 addons/website_livechat/views/website_livechat.xml
@@ -167,19 +167,21 @@
</h5>
<div class="col-lg-12">
<div class="row">
<div class="col-lg-4 pl-0 pr-0">
<img t-attf-src='/rating/static/src/img/rating_10.png' alt="Great" width="16px" height="16px"/>
<span class="align-middle"><t t-esc="ratings_per_user[user.partner_id.id]['great']"/>%</span>
</div>
<div class="col-lg-4 pl-0 pr-0">
<img t-attf-src='/rating/static/src/img/rating_5.png' alt="Okay" width="16px" height="16px"/>
<span class="align-middle"><t t-esc="ratings_per_user[user.partner_id.id]['okay']"/>%</span>
</div>
<div class="col-lg-4 pl-0 pr-0">
<img t-attf-src='/rating/static/src/img/rating_1.png' alt="Bad" width="16px" height="16px"/>
<span class="align-middle"><t t-esc="ratings_per_user[user.partner_id.id]['bad']"/>%</span>
</div>
<t t-if="user.partner_id.id not in ratings_per_user">
<t t-if="user.partner_id.id in ratings_per_user">
<div class="col-lg-4 pl-0 pr-0">
<img t-attf-src='/rating/static/src/img/rating_10.png' alt="Great" width="16px" height="16px"/>
<span class="align-middle"><t t-esc="ratings_per_user[user.partner_id.id]['great']"/>%</span>
</div>
<div class="col-lg-4 pl-0 pr-0">
<img t-attf-src='/rating/static/src/img/rating_5.png' alt="Okay" width="16px" height="16px"/>
<span class="align-middle"><t t-esc="ratings_per_user[user.partner_id.id]['okay']"/>%</span>
</div>
<div class="col-lg-4 pl-0 pr-0">
<img t-attf-src='/rating/static/src/img/rating_1.png' alt="Bad" width="16px" height="16px"/>
<span class="align-middle"><t t-esc="ratings_per_user[user.partner_id.id]['bad']"/>%</span>
</div>
</t>
<t t-else="">
<div class="col-lg-12 pl-0 pr-0 o_livechat_no_rating">Not rated yet</div>
</t>
</div>

0 comments on commit c79d171

Please sign in to comment.
You can’t perform that action at this time.