diff --git a/sf_plan/__manifest__.py b/sf_plan/__manifest__.py index ba43169d..b39ad8af 100644 --- a/sf_plan/__manifest__.py +++ b/sf_plan/__manifest__.py @@ -24,6 +24,8 @@ 'web.assets_qweb': [ ], 'web.assets_backend': [ + 'sf_plan/static/src/js/custom_many2many.js', + 'sf_plan/static/src/xml/custom_many2many.xml', 'sf_plan/static/src/scss/gannt_change.scss', 'sf_plan/static/src/css/button_color.css' ], diff --git a/sf_plan/static/src/js/custom_many2many.js b/sf_plan/static/src/js/custom_many2many.js new file mode 100644 index 00000000..df3c6e48 --- /dev/null +++ b/sf_plan/static/src/js/custom_many2many.js @@ -0,0 +1,22 @@ +/** @odoo-module **/ + +import { Many2ManyCheckboxesField } from "@web/views/fields/many2many_checkboxes/many2many_checkboxes_field"; +import { registry } from "@web/core/registry"; + +export class MyCustomWidget extends Many2ManyCheckboxesField { + // 你可以重写或者添加一些方法和属性 + // 例如,你可以重写setup方法来添加一些事件监听器或者初始化一些变量 + setup() { + console.log('111111111222222222222') + super.setup(); // 调用父类的setup方法 + // 你自己的代码 + } + onImageClick(event) { + // 放大图片逻辑 + console.log('chongchongchong') + } +} +MyCustomWidget.template = "sf_plan.MyCustomWidget" +// MyCustomWidget.supportedTypes = ['many2many']; + +registry.category("fields").add("custom_many2many_checkboxes", MyCustomWidget); diff --git a/sf_plan/static/src/xml/custom_many2many.xml b/sf_plan/static/src/xml/custom_many2many.xml new file mode 100644 index 00000000..805de6e3 --- /dev/null +++ b/sf_plan/static/src/xml/custom_many2many.xml @@ -0,0 +1,23 @@ + + + + +
+ +
+ + + + + + +
+
+
+
+ +