콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
1 회신
2270 화면


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
1520
2
7월 24
5148
0
1월 24
1803
Odoo App 해결 완료
1
11월 23
2105
1
10월 23
2317