Вот что я сделал:
1.Мой компонент OWL:
Код: Выделить всё
/** @odoo-module **/
import { Component } from "@odoo/owl";
export class ProductImageGallery extends Component {
setup() {
console.log("ProductImageGallery component is working");
}
}
ProductImageGallery.template = "multi_image_master.ProductImageGalleryTemplate";
Код: Выделить всё
Product Image Gallery
Gallery of images for this product will appear here.
Предполагается, что компонент будет визуализирован с использованием t-компонента:
Код: Выделить всё
Hello Bharathi
Страница загружается через этот контроллер.
Код: Выделить всё
from odoo import http
from odoo.http import request
class ControllerProductPage(http.Controller):
@http.route('/shop', type='http', auth='public', website=True, csrf=False)
def renderProductPage(self, **kwargs):
return request.render('multi_image_master.ProductPageTemplate', {})
Код: Выделить всё
{
"name": "Product Multi-Image Manager",
"version": "0.1",
"category": "Product",
"depends": ["website"],
"data": [
"views/product_template.xml"
],
"assets": {
"web.assets_backend": [
"multi_image_master/static/src/js/product_image_gallery.js",
"multi_image_master/static/src/xml/product_image_gallery.xml"
]
},
"installable": True,
"application": True,
"license": "LGPL-3"
}
Когда я загружаю маршрут /shop, страница отображает статическое содержимое, но не отображает компонент (t-comComponent=" multi_image_master.ProductImageGallery"). Кроме того, console.log() в методе установки компонента не выполняется, что указывает на то, что компонент не загружается.
Вопрос:
Как правильно визуализировать компонент OWL, используя t-компонент в шаблоне представления Odoo? Я что-то упустил в настройке или регистрации? Любые рекомендации будут оценены.
Подробнее здесь: https://stackoverflow.com/questions/792 ... -templates