Odoo is the world's easiest all-in-one management software. It includes hundreds of business apps:
CRM | e-Commerce | Accounting | Inventory | PoS | Project management | MRP | etc.
UPDATE: Issue was with __openerp__.py, the following line was missing:
I'd like to display all the images attached to a product (as attachments) on the product page (website shop).
I've extended the website_sale class in the main.py controller of the website_sale addon:
@http.route(['/shop/product/<model("product.template"):product>'], type='http', auth="public", website=True)
def product(self, product, category='', search='', **kwargs):
response = super(website_sale_attachment, self).product(product, category='', search='', **kwargs)
attachment_obj = request.env['ir.attachment']
images = attachment_obj.sudo().search([('res_model', '=', 'product.template'), ('res_id', '=', product.id)])
I've inserted the following in the website_sale.product template to check whether the new variable "images" is present in the context:
But I get the following error:
"object of type 'NoneType' has no len()" while evaluating 'len(images)'
It is as if the new key value is not visible from the template.
I've pretty much followed the example in the website_sale_digital addon (master version):
I've restarted the server and rebooted it as well but nothing seems to help. Do you have any idea why this is not working? Thanks.
About This Community
This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.Register
Odoo Training Center
Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.Test it now
|Asked: 1/18/15, 6:46 AM|
|Seen: 1419 times|
|Last updated: 9/25/15, 5:48 AM|