include product images in invoice or offer

include product images in invoice or offer

Postby hcouplet » Mon Mar 08, 2010 2:27 am

Hi,

I would like to include product images in offer our commercial send to customers along with some product description.
To do this I was thinking to add an attachement to products with dedicated name like 'offer_image'.

The question is, what's the best way to do this ?

Here are the different solutions I can see :
1. patch the openErp code to have product object available from invoice_order_line or sale_order_line. This way I can use the get_attachments function on the product object to the get image attachments.
2. patch or submit openoffice.org reporting engine to have an extra function get_attachments_from_objectId(String objectTypeName, int objectID, String attachmentName). ObjectTypeName would be "product_product" and the objectId would be the productId from the invoice_order_line or sale_order_line.
3. use the actual get_attachments function passing a new object with o._name='product_product' and o.id = productId. (I am not sure this is possible).

The next question is how to get the sale product descriptions available in product_template table. This can be used as a product description along with the picture in the offer.

What do you think ?

Hervé
hcouplet
 
Posts: 8
Joined: Tue Mar 02, 2010 6:45 pm

Re: include product images in invoice or offer

Postby sraps » Mon Mar 08, 2010 11:45 am

Hi,
what is the problem(?), it works like that out of the box... No need to extend or patch.

Sales order line has field product_id, which holds reference to product. You can have get_attachments() function used on this product_id and get your "offer_image" by name.

Kaspars
sraps
 
Posts: 403
Joined: Mon May 04, 2009 10:04 pm

Re: include product images in invoice or offer

Postby hcouplet » Mon Mar 08, 2010 1:43 pm

sraps wrote:Hi,
what is the problem(?), it works like that out of the box... No need to extend or patch.

Sales order line has field product_id, which holds reference to product. You can have get_attachments() function used on this product_id and get your "offer_image" by name.

Kaspars


Oups, you're right, my mistake.
I didn't thought that the product_id member would return a product object.

I confirm that :
l.product_id.description_sale
and a frame with :
image: asimage(get_attachments(l.product_id)[0])
are working fine out of the box.

Just a last question, I don't know how to get the correct attachement by name. I tried image: asimage(get_attachments(l.product_id)['offer_image']) without succes. Is there a better way that doing a loop on the attachments and test on the name of it ?

Thanks for your help,
Hervé
hcouplet
 
Posts: 8
Joined: Tue Mar 02, 2010 6:45 pm

Re: include product images in invoice or offer

Postby sraps » Mon Mar 08, 2010 9:12 pm

Try like this:
image: asimage(get_attachments(l.product_id, 'offer_image'))
sraps
 
Posts: 403
Joined: Mon May 04, 2009 10:04 pm


Return to Aeroo Reports & OpenOffice.org Reporting Engine

cron
Copyright © 2001 Alistek Ltd., ALL RIGHTS RESERVED