Skip to content
Snippets Groups Projects
Commit 0dc7d956 authored by qmo-odoo's avatar qmo-odoo Committed by Thibault Delavallée
Browse files

[FIX] website_slides: Fix traceback when creating content in mobile


This commit fixes the traceback that happens when we try to create
a question from the survey form in mobile mode.

The problem was due to the context not being propagated
to the "add record" button that appears in mobile mode.
Therefore, as we use that context in our widget, it crashes.

The solution to this is to just use the normal tree view behavior
instead of our override when we are in a mobile environment.

LINKS

closes odoo/odoo#40694

Taskid: 2071342
Pr: #40694
Signed-off-by: default avatarThibault Delavallee (tde) <tde@openerp.com>
parent b394a67c
Branches
Tags
No related merge requests found
......@@ -5,6 +5,7 @@ var Context = require('web.Context');
var FieldOne2Many = require('web.relational_fields').FieldOne2Many;
var FieldRegistry = require('web.field_registry');
var ListRenderer = require('web.ListRenderer');
var config = require('web.config');
var SectionListRenderer = ListRenderer.extend({
init: function (parent, state, params) {
......@@ -165,12 +166,13 @@ var SectionFieldOne2Many = FieldOne2Many.extend({
* @param {*} ev
*/
_onAddRecord: function (ev) {
var context_str = ev.data.context && ev.data.context[0];
var context = new Context(context_str).eval();
if (context['default_' + this.sectionFieldName]){
this.editable = "bottom";
} else {
this.editable = null;
this.editable = null;
if (!config.device.isMobile){
var context_str = ev.data.context && ev.data.context[0];
var context = new Context(context_str).eval();
if (context['default_' + this.sectionFieldName]){
this.editable = "bottom";
}
}
this._super.apply(this, arguments);
},
......
......@@ -61,7 +61,7 @@
</div>
<notebook colspan="4">
<page name="content" string="Content">
<field name="slide_ids" colspan="4" nolabel="1" widget="slide_category_one2many" context="{'default_channel_id': active_id}">
<field name="slide_ids" colspan="4" nolabel="1" widget="slide_category_one2many" mode="tree,kanban" context="{'default_channel_id': active_id}">
<tree decoration-bf="is_category" editable="bottom">
<field name="sequence" widget="handle"/>
<field name="name"/>
......
......@@ -170,7 +170,7 @@
t-att-src="kanban_image('slide.channel', 'image_128', record.channel_id.raw_value)"/>
</div>
<div class="oe_kanban_details d-flex flex-column">
<strong class="o_kanban_record_title oe_partner_heading"><field name="display_name"/></strong>
<strong class="o_kanban_record_title oe_partner_heading"><field name="name"/></strong>
<div class="text-mutex"><field name="channel_id"/></div>
<div class="o_kanban_tags_section mb-2">
<span class="oe_kanban_list_many2many">
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment