diff --git a/web_help/static/src/components/help_button/help_button.esm.js b/web_help/static/src/components/help_button/help_button.esm.js index 24b3a7bed..6e35d751a 100644 --- a/web_help/static/src/components/help_button/help_button.esm.js +++ b/web_help/static/src/components/help_button/help_button.esm.js @@ -2,21 +2,24 @@ import LegacyControlPanel from "web.ControlPanel"; import {ControlPanel} from "@web/search/control_panel/control_panel"; import {findTrip} from "@web_help/helpers.esm"; -import {Component, useState} from "@odoo/owl"; +import {Component, onWillStart, useState} from "@odoo/owl"; import {ActionDialog} from "@web/webclient/actions/action_dialog"; export class HelpButton extends Component { setup() { - const foundTrip = findTrip(this.props.resModel, this.props.viewType); this.state = useState({ - TripClass: foundTrip, + TripClass: null, + }); + onWillStart(async () => { + const foundTrip = await findTrip(this.props.resModel, this.props.viewType); + this.state.TripClass = foundTrip; }); } - onClick() { + async onClick() { const TripClass = this.state.TripClass; const trip = new TripClass(this.env); - trip.setup(); + await trip.setup(); trip.start(); } } diff --git a/web_help/static/src/components/help_button/help_button.xml b/web_help/static/src/components/help_button/help_button.xml index d46fdae6c..029fa32d9 100644 --- a/web_help/static/src/components/help_button/help_button.xml +++ b/web_help/static/src/components/help_button/help_button.xml @@ -3,15 +3,16 @@ - +