Odoo:JS自定义小部件在卸载开票模块后停止工作

2024-05-19 13:32:17 发布

您现在位置:Python中文网/ 问答频道 /正文

我有一个js自定义小部件,它是在posthttps://stackoverflow.com/a/59518788/6089149中提供的,它所做的是当单击One2many字段的showmore超链接时,它会在弹出窗口中打开整个模型树视图,而不是常规的下拉列表 在我删除发票模块之前,它一直工作正常。我试图重新安装相同的模块,但没有成功 我还尝试在新的odoo安装上重新安装我的自定义模块,但仍然无法工作 我试着检查控制台,结果发现下面的错误

boot.js:264 Error while loading bearings_module.open_list_view: TypeError: Cannot read property 'extend' of undefined
    at show_more.js:101
    at boot.js:260
    at new Promise (<anonymous>)
    at processJob (boot.js:258)
    at Object.odoo.processJobs (boot.js:316)
    at Object.odoo.define (boot.js:154)
    at show_more.js:1
(anonymous) @ boot.js:264
processJob @ boot.js:258
odoo.processJobs @ boot.js:316
odoo.define @ boot.js:154
(anonymous) @ show_more.js:1

show_more.js是wiget文件。 深入研究之后,在开发人员模式下激活资产调试之后,我发现在这个块中发生了一个错误

var AddManyFieldOne2Many = fieldRegistry.map.section_and_note_one2many.extend({

编辑1:再挖一些,我发现了这个

error: TypeError: Cannot read property 'extend' of undefined at http://192.168.1.205:8069/bearings_module/static/src/js/show_more.js:101:76 at process_job (http://192.168.1.205:8069/web/static/src/js/boot.js:226:44) at Object.process_jobs (http://192.168.1.205:8069/web/static/src/js/boot.js:268:17) at Object.define (http://192.168.1.205:8069/web/static/src/js/boot.js:139:18) at http://192.168.1.205:8069/bearings_module/static/src/js/show_more.js:1:6
message: "Cannot read property 'extend' of undefined"
stack: "TypeError: Cannot read property 'extend' of undefined↵    at http://192.168.1.205:8069/bearings_module/static/src/js/show_more.js:101:76↵    at process_job (http://192.168.1.205:8069/web/static/src/js/boot.js:226:44)↵    at Object.process_jobs (http://192.168.1.205:8069/web/static/src/js/boot.js:268:17)↵    at Object.define (http://192.168.1.205:8069/web/static/src/js/boot.js:139:18)↵    at http://192.168.1.205:8069/bearings_module/static/src/js/show_more.js:1:6"
__proto__: Error

编辑2: 我将文件account/static/src/js/section_and_note_fields_backend.js复制到模块的js文件夹,并将其包含在项目中,现在它停止显示错误boot.js:264 Error while loading bearings_module.open_list_view: TypeError: Cannot read property 'extend' of undefined,但显示了另一个错误

raceback:
TypeError: Cannot read property 'focusableElement' of null
    at FieldWrapper.getFocusableElement (http://192.168.1.206:8069/web/static/src/js/fields/field_wrapper.js:108:45)
    at http://192.168.1.206:8069/web/static/src/js/views/list/list_editable_renderer.js:496:34
    at Function._.each._.forEach (http://192.168.1.206:8069/web/static/lib/underscore/underscore.js:145:9)
    at toggleWidgets (http://192.168.1.206:8069/web/static/src/js/views/list/list_editable_renderer.js:495:15)
    at Class.unselectRow (http://192.168.1.206:8069/web/static/src/js/views/list/list_editable_renderer.js:501:9)
    at Object.onSuccess (http://192.168.1.206:8069/bearings_module/static/src/js/show_more.js:72:34)
    at http://192.168.1.206:8069/web/static/src/js/fields/relational_fields.js:1981:30

Tags: srcwebhttpreadobjectmoreshowjs