I am trying to add a file upload button on the bank reconciliation widget through:
<t t-name="account_statement_custom.BankRecRecordFormButtonsHeaderLeft" t-inherit="account_accountant.BankRecRecordFormButtonsHeaderLeft" t-inherit-mode="extension">
<xpath expr="//div[hasclass('o_bank_rec_stats_buttons_aside_left')]" position="inside">
<FileInput>
Upload
</FileInput>
</xpath>
</t>
I have added FileInput to the Controller through patching:
import { FileInput } from "@web/core/file_input/file_input";
patch(BankRecKanbanController.components, {
FileInput,
});But I am still getting the error:
OwlError: Cannot find the definition of component "FileInput"
This seems strange. If I add the FileInput component in the BankRecKanbanController code itself. So I feel like it should work through this patch mechanism as well. What am I missing?
Thank you,
Refer below examples from Odoo Default
import { Discuss } from "@mail/core/public_web/discuss";
import { Call } from "@mail/discuss/call/common/call";
import { useState } from "@odoo/owl";
import { useService } from "@web/core/utils/hooks";
import { patch } from "@web/core/utils/patch";
Object.assign(Discuss.components, { Call });
patch(Discuss.prototype, {
setup() {
super.setup(...arguments);
this.rtc = useState(useService("discuss.rtc"));
},
});
import { registry } from "@web/core/registry";
import { AccountFileUploader } from "@account/components/account_file_uploader/account_file_uploader";
import { UploadDropZone } from "@account/components/upload_drop_zone/upload_drop_zone";
import { BankRecKanbanView, BankRecKanbanController, BankRecKanbanRenderer } from "@account_accountant/components/bank_reconciliation/kanban";
import { useState } from "@odoo/owl";
export class BankRecKanbanUploadController extends BankRecKanbanController {
static components = {
...BankRecKanbanController.components,
AccountFileUploader,
}
}
Try this:
import { BankRecKanbanController } from "@account_accountant/components/bank_reconciliation/kanban";
import { FileInput } from "@web/core/file_input/file_input";
import { patch } from "@web/core/utils/patch";
patch(BankRecKanbanController, {
components: {
...BankRecKanbanController.components,
FileInput,
},
});