[英]How to extend/inherit form_view.js in odoo 15
Am using Odoo15 customized in file web\static\src\js\views\form_view.js as below method:我正在使用在文件 web\static\src\js\views\form_view.js 中定制的 Odoo15,方法如下:
form_view.js
odoo.define('web.FormRenderingEngine', function (require) {
"use strict";
process_group: function($group) {
// custom Code
}
});
Am extending this file like as mention below:我正在扩展此文件,如下所述:
var FormRenderingEngine = require('web.FormRenderingEngine');
return FormRenderingEngine.extend({
process_group: function($group) { // custom Code
}
}};
.extend or include doesn't work. .extend 或 include 不起作用。
please anyone help me to resolve this.请任何人帮我解决这个问题。
If you look in the console log you will see the following error message:如果您查看控制台日志,您将看到以下错误消息:
Uncaught SyntaxError: functions cannot be labelled
It is related to form_view.js
script.它与
form_view.js
脚本有关。 To create a new form renderer, you can extend the basic renderer or the form renderer like they did with the product configurator要创建新的表单渲染器,您可以像使用产品配置器一样扩展基本渲染器或表单渲染器
Example: (extending the basic renderer)示例:(扩展基本渲染器)
odoo.define('web.FormRenderingEngine', function (require) {
"use strict";
var BasicRenderer = require('web.BasicRenderer');
var FormRenderingEngine = BasicRenderer.extend({
process_group: function($group) {
// custom Code
},
});
return FormRenderingEngine;
});
In the FormRenderingEngine
, you have a syntax error:在
FormRenderingEngine
中,您有一个语法错误:
Uncaught SyntaxError: missing ) after argument list
It should end with });
它应该以
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.