[REF] *: csrf_token is not available in the rendering context

As the templates are now rendered with owl, csrf_token is not available
in the rendering context.

Part of task~3443861

Part-of: odoo/odoo#130467
This commit is contained in:
Jorge Pinna Puissant
2023-08-11 14:32:30 +02:00
committed by Samuel Degueldre
parent 1e37bf60da
commit 065a2f451a
5 changed files with 5 additions and 3 deletions
+1 -1
View File
@@ -279,7 +279,7 @@
<div t-attf-class="o_hidden_input_file #{fileupload_class or ''}" t-att-style="fileupload_style" aria-atomic="true">
<form class="o_form_binary_form" t-att-target="fileupload_id"
method="post" enctype="multipart/form-data" t-att-action="fileupload_action || '/web/binary/upload'">
<input type="hidden" name="csrf_token" t-att-value="csrf_token"/>
<input type="hidden" name="csrf_token" t-att-value="window.odoo.csrf_token"/>
<input type="hidden" name="callback" t-att-value="fileupload_id"/>
<input type="file" class="o_input_file" name="ufile"
t-att="{'multiple': multi_upload ? 'multiple' : null, 'accept': widget.accepted_file_extensions || '*'}"/>
@@ -14,6 +14,7 @@ publicWidget.registry.websiteEventMeetingRoom = publicWidget.Widget.extend({
start: function () {
this._super.apply(this, arguments);
this.csrf_token = odoo.csrf_token;
this.meetingRoomId = parseInt(this.$el.data('meeting-room-id'));
},
@@ -41,7 +41,7 @@
</select>
</div>
<input name="event" t-att-value="event" type="hidden"/>
<input name="csrf_token" t-att-value="csrf_token" type="hidden"/>
<input name="csrf_token" t-att-value="widget.csrf_token" type="hidden"/>
</form>
</main>
<footer class="modal-footer justify-content-start">
@@ -28,6 +28,7 @@ var CategoryAddDialog = Dialog.extend({
}]
}, options || {});
this.csrf_token = odoo.csrf_token;
this.channelId = options.channelId;
this._super(parent, options);
},
@@ -16,7 +16,7 @@
<t t-name="slides.category.add">
<div>
<form action="/slides/category/add" method="POST" id="slide_category_add_form">
<input type="hidden" name="csrf_token" t-att-value="csrf_token"/>
<input type="hidden" name="csrf_token" t-att-value="widget.csrf_token"/>
<input type="hidden" name="channel_id" t-att-value="widget.channelId"/>
<div class="mb-3 row">
<label for="section_name" class="col-sm-3 col-form-label">Section name</label>