跳至内容
菜单
此问题已终结
2 回复
3011 查看

Hi

I'm using Odoo v16 and I want to use Odoo Official Frontend Docs for v16 as an example.


In the tutorial, we created the Counter OWL Component.

But in the example, they created a controller and initiated the whole OWL stack from the ground (owl_playground.assets_playground​ asset).


I want to use the component inside an existing frontend page. assume I want to show the counter on my home page of the website (not a custom page initiated with from a controller and custom template and main.js​)


How can I do that?

What should I do?


Alternatively, it will be good if I can create a website snippet for that counter or any other Odoo component.

形象
丢弃
最佳答案

Hi,

What you want to achieve can be better implied using a snippet on a website. That way, you can drag and drop the snippet according to your need.
You can refer to this blog to check that out.https://www.cybrosys.com/blog/how-to-create-a-snippet-in-odoo-16

Hope it helps

形象
丢弃
编写者

Thank you, But the tutorial doesn't explain how to add options to the snippet.
Also, I want to use existing components like the counter.
again we face the problem that my component is not recognized in the templates (of snippet)

最佳答案

Hi, I am having the same issue, trying to understand how to add custom owl components to portal templates in my odoo project.

It is not clear from the official tutorial what needs to be done in order to make it work. I looked in Odoo 16' codebase hoping to find clues on how it is integrated, but couldn't find an answer.

I don't want to use the editor as i want all my templates to be in my codebase and versioned with the rest of my code.

Is there a step by step tutorial on how to integrate a custom Owl component in a portal template, showing which files and code is needed where in order for it to work?

形象
丢弃
相关帖文 回复 查看 活动
1
6月 24
3042
0
12月 23
1618
1
8月 23
3972
2
7月 25
133
2
7月 24
4803