تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
4 الردود
6837 أدوات العرض

I've added the summernote text editor to a textarea. And when I'm logged in as admin it works, but any other user gets just a normal textarea. In the console there is:

error: Some modules could not be started

Failed modules: ["tabla_project_ticket_web.web_editor"]

The js code:

odoo.define('tabla_project_ticket_web.web_editor', function (require) {
'use strict';

var website = require('website.website');


$('textarea.load_editor').each(function () {
var $textarea = $(this);
if (!$textarea.val().match(/\S/)) {
$textarea.val("<p><br/></p>");
}
var $form = $textarea.closest('form');
var toolbar = [
['style', ['style']],
['font', ['bold', 'italic', 'underline', 'clear']],
['para', ['ul', 'ol', 'paragraph']],
['color', ['color']],
['history', ['undo', 'redo']],
['insert', ['link', 'picture']],
];

$textarea.summernote({
height: 300,
toolbar: toolbar,
styleWithSpan: false

});

});

});

Does any one know what could be the problem? In the odoo documentation Failed modules means that a javascript error is detected, but why does it run ok when logged in as admin? 

EDIT:

The summernote editor is shown only when the user has some website rights, editor or restricted editor. But I need to work this with only the Portal group rights. I've tried with the code from website_forum, but it doesn't work.

<template id="ticket_layout" inherit_id="website.layout" name="Ticket Layout" primary="True">
<xpath expr="//t[@t-call-assets='web_editor.summernote'][@t-js='false']" position="attributes">
<attribute name="groups"/>
</xpath>
<xpath expr="//t[@t-call-assets='web_editor.summernote'][@t-css='false']" position="attributes">
<attribute name="groups"/>
</xpath>
</template>



الصورة الرمزية
إهمال

have you tried asset mode while logged in as user?

الكاتب

The portal user doesn't have permissions to have assets mode. With the admin user I can see that the above template is loaded the same as on the other odoo instance where I have website_forum installed and every user sees the summernote text editor.

الكاتب أفضل إجابة

After checking everything and reading it's documentation I figured out that the problem is the primary="True" attribute. So it didn't remove the security groups attribute from the inherited template, but it created a new template from the inherited template that I newer loaded. 

الصورة الرمزية
إهمال
أفضل إجابة

I have the same problem. When I am logued with a website admin the editor is ok but I need it when the user is nos website editor.

Were you able to fix it? I have tried the edit in your post but the problem remains,

الصورة الرمزية
إهمال
الكاتب

check the permissions for the user. This worked for odoo 10 CE. Never tried on different version.

المنشورات ذات الصلة الردود أدوات العرض النشاط
0
ديسمبر 17
3923
1
يونيو 24
1144
1
يناير 20
7740
1
يوليو 19
3554
0
يوليو 19
3322