How do I create my first widget? And how to display it on my form view? If someone can give me a very detailed example, that would be great. A simple widget displaying a text/button in my form. Just so I understand how it works. I've tested several things but nothing works. Please help me !!!!!
My version is Odoo 14.
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- إدارة علاقات العملاء
- e-Commerce
- المحاسبة
- المخزون
- PoS
- Project
- MRP
لقد تم الإبلاغ عن هذا السؤال
1
الرد
5023
أدوات العرض
Using this way or try
odoo.define('your_file.any_name', function(require) {
"use strict";
var field_registry = require('web.field_registry');
var AbstractField = require('web.AbstractField');
var FormController = require('web.FormController');
FormController.include({
_update: function () {
var _super_update = this._super.apply(this, arguments);
this.trigger('view_updated');
return _super_update;
},
});
var widget_name = AbstractField.extend({
template: 'TemplatName',
start: function() {
var self = this;
this.getParent().getParent().on('view_updated', self, function() {
self.your_method();
self.getParent().$('a[data-toggle="tab"]').on('shown.bs.tab', function() {
self.your_method();
});
});
return this._super();
},
your_method: function() {
},
});
field_registry.add('name_widget_add_to_field', widget_name);
return {
widget_name: widget_name,
};
});
هل أعجبك النقاش؟ لا تكن مستمعاً فقط. شاركنا!
أنشئ حساباً اليوم لتستمتع بالخصائص الحصرية، وتفاعل مع مجتمعنا الرائع!
تسجيلالمنشورات ذات الصلة | الردود | أدوات العرض | النشاط | |
---|---|---|---|---|
|
0
يناير 24
|
815 | ||
|
1
مايو 23
|
2569 | ||
|
0
ديسمبر 21
|
2362 | ||
|
0
ديسمبر 21
|
2825 | ||
|
0
مايو 25
|
12 |