如何在Odoo V13中自定义Web编辑Top-Menu?
我创建了一个新的模块(“ webeditor_custom”),以自定义ODOO V13 Web Editor顶部菜单,以在现有菜单项中添加自定义字体大小。
我的模块中的文件” webeditor_custom”为:
- 模板/assets.xml文件:
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<template id="summernote_cust" name="My summernote assets" inherit_id="web_editor.summernote">
<xpath expr="//script[last()]" position="after">
<script type="text/javascript" src="/webeditor_custom/static/src/js/summernote_cust.js"></script>
</xpath>
</template>
</odoo>
- in/static/src/js/directory,我有我的summernote_cust.js file:
odoo.define('web_editor.summernote_cust', function (require) {
'use strict';
var core = require('web.core');
var editor = require('web_editor.summernote');
require('summernote/summernote'); // wait that summernote is loaded
var _t = core._t;
var options = $.summernote.options;
options.fontSizes = [_t('Default'), 8, 9, 10, 11, 12, 13, 14, 16, 18, 21, 24, 28, 32, 36, 42, 49, 56, 63];
return $.summernote;
});
- 我的 sustest .py文件:
{
"name": "Web editor custom",
"summary": "Add font-sizes to the top-menu of the web editor",
"version": "13.0.2.0.1",
"installable": True,
"depends": ["web_editor"],
"data": ["templates/assets.xml"],
}
安装我的模块后,我在主页的第一个负载上显示此错误(弹出):
“ error:service web_editor.summernote_cust已经定义了” >
感谢您是否有办法处理它(ODOO V13上的Summernote)或解决方法!
I have created a new module ("webeditor_custom") to customize Odoo v13 Web editor Top menu to add custom font-sizes in the existing menu items.
The files in my module "webeditor_custom" are :
- templates/assets.xml file :
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<template id="summernote_cust" name="My summernote assets" inherit_id="web_editor.summernote">
<xpath expr="//script[last()]" position="after">
<script type="text/javascript" src="/webeditor_custom/static/src/js/summernote_cust.js"></script>
</xpath>
</template>
</odoo>
- In /static/src/js/ directory, i have my summernote_cust.js file :
odoo.define('web_editor.summernote_cust', function (require) {
'use strict';
var core = require('web.core');
var editor = require('web_editor.summernote');
require('summernote/summernote'); // wait that summernote is loaded
var _t = core._t;
var options = $.summernote.options;
options.fontSizes = [_t('Default'), 8, 9, 10, 11, 12, 13, 14, 16, 18, 21, 24, 28, 32, 36, 42, 49, 56, 63];
return $.summernote;
});
- my manifest.py file:
{
"name": "Web editor custom",
"summary": "Add font-sizes to the top-menu of the web editor",
"version": "13.0.2.0.1",
"installable": True,
"depends": ["web_editor"],
"data": ["templates/assets.xml"],
}
After installing my module, i get this error (popup) displayed on the first load of my homepage:
"Error: Service web_editor.summernote_cust already defined"
Thank you if you have a way to deal with it (summernote on odoo v13) or a workaround !
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试将您的脚本添加到
Assets_wysiwyg
捆绑包中,因此将在所有 summernote 脚本示例:
Try to add your script to the
assets_wysiwyg
bundle, so it will be added after all the summernote scriptsExample: