'How to open a search dialog using an OWL component?
I am trying to open a search dialog similar to what happens when you click on "Search More..." on a Many2one field widget using OWL. I understand this has to be done with Javascript.
Here's the component I have written:
odoo.define("somari.ImportFromTemplate", function (require) {
const { Component } = owl;
const FormRenderer = require("web.FormRenderer");
const { ComponentWrapper } = require("web.OwlCompatibility");
var Dialog = require('web.view_dialogs');
class ImportFromTemplate extends Component {
static template = "somari.ImportFromTemplate";
clicked(event){
var diag = new Dialog.SelectCreateDialog(this, {
res_model: 'somari.template',
title: "Select template"
});
diag.open();
}
};
FormRenderer.include({
async _render() {
await this._super(...arguments);
for(const element of this.el.querySelectorAll(".somari_import_from_template")) {
(new ComponentWrapper(this, ImportFromTemplate))
.mount(element)
}
}
});
});
There's an error on the instruction diag.open():
Uncaught (in promise) TypeError: parent._trigger_up is not a function
I can't figure out how to solve this. Any clue what's wrong here or what I am doing wrong?
Thanks!
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|