跳至内容
菜单
此问题已终结
1 回复
2103 查看


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.





形象
丢弃
最佳答案

Try this:

const { onWillStart } = owl;

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

形象
丢弃
相关帖文 回复 查看 活动
1
4月 25
1335
2
7月 24
4925
0
1月 24
1531
Odoo App 已解决
1
11月 23
1892
1
10月 23
2169