[FIX] website: avoid traceback when clicking on stat buttons

Prior to this commit, if we go to visitors form view and clicked on
stat buttons like offline/connected or visits, a traceback was
thrown because the buttons are meant for showing stat only, they
aren't linked to real actions / methods. It used to work before, but
the recent traceback is result of more strict checks from the web-client
re-write. See the original commit[1] for more information.

This commit sets 'disabled' attribute on the buttons, and keeps the action
from being performed for display-only stat buttons.

commit[1] - https://github.com/odoo/odoo/commit/0573acae2306bf5da2005852da9323ddc59e5431

TaskID-2593552

closes odoo/odoo#73813

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
This commit is contained in:
ijas ahammed
2021-07-19 10:04:53 +00:00
parent b54c199c88
commit 3e37cb92c8
@@ -181,15 +181,15 @@
</header>
<sheet>
<div class="oe_button_box" name="button_box">
<button class="oe_stat_button o_stat_button_info" attrs="{'invisible': [('is_connected', '=', False)]}">
<button class="oe_stat_button o_stat_button_info" disabled="1" attrs="{'invisible': [('is_connected', '=', False)]}">
<i class="fa fa-fw o_button_icon fa-circle text-success"/>
<span>Connected</span>
</button>
<button class="oe_stat_button o_stat_button_info" attrs="{'invisible': [('is_connected', '=', True)]}">
<button class="oe_stat_button o_stat_button_info" disabled="1" attrs="{'invisible': [('is_connected', '=', True)]}">
<i class="fa fa-fw o_button_icon fa-circle text-danger"/>
<span>Offline</span>
</button>
<button id="w_visitor_visit_counter" class="oe_stat_button o_stat_button_info" icon="fa-globe">
<button id="w_visitor_visit_counter" class="oe_stat_button o_stat_button_info" disabled="1" icon="fa-globe">
<field name="visit_count" widget="statinfo" string="Visits"/>
</button>
<button name="%(website.website_visitor_page_action)d" type="action"