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

closes #32553

Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
  • Loading branch information...
pka-odoo authored and rdeodoo committed Apr 9, 2019
1 parent 9787aba commit 3992b01de1420be0f57dac6a387e5005c329b37a
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 3992b01

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