Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
1 Trả lời
2162 Lượt xem


Hello,

I have two modules:

1. custom_copy_odoo_16.js


odoo.define('isha_crm.custom_copy_odoo_16', function (require) {
'use strict';
alert('custom copy');
const Widget = require('web.Widget');
      const MyApp = Widget.extend({
          events: {
         'click .o_form_label': '_onClickTargetElement',
        },
        _onClickTargetElement: function (ev) {
// Handle click event on target element
      console.log('Target element clicked!', ev);
      },
   });
return MyApp;
});





2. consume_custom_copy_odoo_16.js (I implemented this just to test the first one)

odoo.define('isha_crm.consume_custom_copy_odoo_16', function (require) {
'use strict';
​const MyApp = require('isha_crm.custom_copy_odoo_16');
​const core = require('web.core');
​ console.log('MyApp');
​ console.log(MyApp);
​ const App = MyApp.extend({
​    async willStart() {
​    alert('willStart started');
​    await this._super(...arguments);
​   this.$el.appendTo('body');
​   alert('willStart ended');
   },

});
core.action_registry.add('consume_custom_copy_odoo_16', App);
return App;
});





My issue - async willStart() {} is not getting triggered.





Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

Try this:

const { onWillStart } = owl;

onWillStart(() => alert('willStart started');
​    await this._super(...arguments);
​   this.$el.appendTo('body');
​   alert('willStart ended'););

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 4 25
1410
2
thg 7 24
5045
0
thg 1 24
1683
Odoo App Đã xử lý
1
thg 11 23
2008
1
thg 10 23
2260