1
이것은 내 XML 코드입니다. 내가 버튼을 클릭하면 그것은 다음과 같은 오류 보여줍니다ReferenceError : 인스턴스가 정의되지 않았습니다.
ReferenceError: instance is not defined
<?xml version="1.0" encoding="UTF-8"?>
<templates id="template" xml:space="preserve">
<t t-extend="ListView.buttons">
<t t-jquery="button.o_list_button_add" t-operation="after">
<t t-if="widget.model=='ref.reference'">
<button class="btn btn-sm btn-default" type="button">Enable</button>
<button class="btn btn-sm btn-primary disable_ref" type="button">Disable</button>
</t>
</t>
</t>
</templates>
이 자바 스크립트에를이 코드에 무슨 일이
JS에
var ListView = require('web.ListView');
ListView.include({
render_buttons: function() {
// GET BUTTON REFERENCE
this._super.apply(this, arguments)
if (this.$buttons) {
var btn = this.$buttons.find('.disable_ref')
}
// PERFORM THE ACTION
btn.on('click', this.proxy('do_new_button'))
},
do_new_button: function() {
instance.web.Model('ref.reference')
.call('ref_dis', [[]])
}
})
게시 된 코드에서 액세스하려고하는 곳을 제외하고 어디에도 '인스턴스'가 없습니다. 감사하지만 처리가없는 [최소, 완전하며 검증 가능한 예] (https://stackoverflow.com/help/mcve) – Galen