M.E.
M.E.

Reputation: 5496

Odoo 10 - Retrieve image from product_template

I am trying to get the image of a given product in Odoo 10.

Specifically, I want to retrieve the image object from a product_template record in order to copy it to another product_template record.

I have tried the following code without success:

self.env['product.template'].search([('id', '=', product_id)]).image

How could I retrieve the image once I have the product_template record instance?

Odoo 10 community

Upvotes: 1

Views: 296

Answers (1)

Younis Mahsud
Younis Mahsud

Reputation: 517

In odoo v10 I think the image field name is image_medium. You need to write the statement as like this: self.env['product.template'].search([('id', '=', product_id)]).image_medium For reference you can check this method in product.product model. def _compute_images().

Upvotes: 1

Related Questions