Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
1 Trả lời
6629 Lượt xem

Hi, 

I'd like to access my product titles (or other fields) programmatically from a QWeb view (i.e. web page) that is NOT based on model data 'Products'. How would I best do that?

An example would be a simple website widget that loops through all products with t-foreach and lists all product titles.

Thanks!
Frank

Ảnh đại diện
Huỷ bỏ
Tác giả Câu trả lời hay nhất

For other people who are wondering the same - this is one option that worked for me:

1.) Create a module and a controller which obtains the data required and which you can call via a URL.

2) Insert an AJAX snippet on the homepage calling your controller to obtain the data.

I am certain there are other (and maybe better) ways...

Frank

Ảnh đại diện
Huỷ bỏ

@Frank, Thanks for the suggestions. Do you have a github repository with and example of the code you used to achieve this by any chance? I'm currently building this to add support for multiple product images for 8.0 as a community module: https://github.com/OdooCommunityWidgets/website_multi_image and i'm trying to figure out how to use t-foreach to output a list of all the images in the one2many in the module, however i'm just getting started with Odoo development and have hit a brick wall trying to figure this out. If you have examples that you're able to share on how you achieved the above i'd be very interested to take a look.

Bài viết liên quan Trả lời Lượt xem Hoạt động
4
thg 4 25
2902
0
thg 6 20
2852
0
thg 3 22
1816
0
thg 6 20
5308
0
thg 8 25
125