[FIX] website_forum: prevent crash when trying to create a forum

An extra xml dependency was inadvertently added in the ForumCreateDialog in
commit [1] by inheriting the web_editor.toolbar template, since the file where
it is inherited is an xml dependency of the ForumCreateDialog widget. While the
dependency is correctly loaded in the public widget it is not in the creation
dialog widget, resulting in a crash.

Furthermore, the ForumCreateDialog widget does not actually need this template
and neither does the public widget need the other templates already present
in the same file at the time of the mentioned commit. Moving the extended
toolbar template to the website_forum_share_templates file, allows for removing
of the unnecessary dependencies. This includes the missing dependency of the
ForumCreateDialog, preventing the crash.

[1]: 740168ce8d

task-2749467

X-original-commit: 4ad966de67278c2081c1896c354b9b1782cf6dc1
Part-of: odoo/odoo#85998
This commit is contained in:
Tom De Caluwé
2022-03-09 13:12:44 +00:00
committed by qsm-odoo
parent 74f55ac035
commit 1d0b427b67
3 changed files with 13 additions and 14 deletions
@@ -16,7 +16,6 @@ publicWidget.registry.websiteForum = publicWidget.Widget.extend({
selector: '.website_forum',
xmlDependencies: [
'/web_editor/static/src/xml/editor.xml',
'/website_forum/static/src/xml/website_forum_templates.xml',
'/website_forum/static/src/xml/website_forum_share_templates.xml',
],
events: {
@@ -72,4 +72,17 @@
</div>
</div>
</t>
<t t-name="website_forum.web_editor_toolbar" t-extend="web_editor.toolbar">
<t t-jquery="li#heading1-dropdown-item" t-operation="replace"/>
<t t-jquery="li#heading2-dropdown-item" t-operation="replace"/>
<t t-jquery="li#heading3-dropdown-item" t-operation="replace"/>
<t t-jquery="div#font-size" t-operation="replace"/>
<t t-jquery="div#colorInputButtonGroup" t-operation="replace"/>
<t t-jquery="div#toolbar" t-operation="append">
<div id="history" class="btn-group">
<div id="undo" data-call="undo" class="btn fa fa-undo"/>
<div id="redo" data-call="redo" class="btn fa fa-repeat"/>
</div>
</t>
</t>
</templates>
@@ -50,17 +50,4 @@
</div>
</form>
</t>
<t t-name="website_forum.web_editor_toolbar" t-extend="web_editor.toolbar" primary="True">
<t t-jquery="li#heading1-dropdown-item" t-operation="replace"/>
<t t-jquery="li#heading2-dropdown-item" t-operation="replace"/>
<t t-jquery="li#heading3-dropdown-item" t-operation="replace"/>
<t t-jquery="div#font-size" t-operation="replace"/>
<t t-jquery="div#colorInputButtonGroup" t-operation="replace"/>
<t t-jquery="div#toolbar" t-operation="append">
<div id="history" class="btn-group">
<div id="undo" data-call="undo" class="btn fa fa-undo"/>
<div id="redo" data-call="redo" class="btn fa fa-repeat"/>
</div>
</t>
</t>
</templates>