Odoo Help

Welcome!

This community 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.

0

Image of Product in Purchase Order?

By
aci aisha
on 2/24/15, 12:26 AM 1,651 views

Friends,

Can we add the image of product in purchase order line.

For example Now if we select a product it automatically displays the Description,Unit price etc..

I want to display the product image automatically in purchase order line..

Is it possible?

Thanks

@aci,
It's definitely possible, depending on your requirements. Do you want the image to appear in list view while you are editing it, or in the printed reports?

I'd recommend referring to this thread for more information on a module for 7.0:

https://www.odoo.com/forum/help-1/question/odoo-7-how-can-i-add-images-in-sale-oder-line-or-in-treeview-generally-483

Here's my 8.0 version of Stefan's original 7.0 module here:

https://github.com/OdooCommunityWidgets/product_image_list_view

If you are looking to add them to the printed report (eg. PDF output), then there are many other methods, including Aeroo Reports, and modifying the views yourself to place an image on the order line of the report.

Please let me know if you run into any issues.

Luke Branch
on 2/24/15, 12:44 AM

I want to add the images in purchase.order.line .. Is it possible through this module?

aci aisha
on 2/24/15, 12:46 AM

Hi Luke,Its working fin.I can add images in sale.order.Actually i want to add in purchase.How it possible?

aci aisha
on 2/24/15, 1:09 AM

& this error occured when i press create button of stock move, File "/home/amz02/Projects/odoo/odoo-8.0-647afdf/openerp/addons/product_image_list_view-8/stock.py", line 12, in onchange_product_id res_prod['value'].update({'image_small': obj.image_small}) KeyError: 'value'

aci aisha
on 2/24/15, 1:17 AM

@aci,

This module was thrown together for SO lines from the original 7.0 module from Stefan.

In regards to the stock move error, i'd need to investigate on my own instance. Could you provide me with steps to reproduce the error?

I'd be happy to modify it to include features for PO lines as well, as this is a use-case that I will use in the future as well. Please provide me with your exact requirements (eg. both printed reports and live tree view), and i'll do my best to implement the changes.

Luke Branch
on 2/24/15, 5:49 AM

Look at the answer of Vasanth..It adds the images in purchase.order.line also

aci aisha
on 2/24/15, 6:11 AM

Can u give ur email id to discuss more

aci aisha
on 2/24/15, 6:11 AM

@aci,

Please check my email address on the github profile here:

https://github.com/odoocommunitywidgets

Luke Branch
on 2/24/15, 9:36 PM

I ddnt got ue mail there.Can u text me in gmail(hangout).My id is aciaisha@gmail.com

aci aisha
on 2/25/15, 12:02 AM
4

Vasanth

--Vasanth--
3458
| 5 3 8
Pondicherry, India
--Vasanth--
Vasanth
On 2/24/15, 2:45 AM

hi, you can add the image of product in purchase order line,

Use this following code:

in py file:

class purchase_order_line(osv.osv):
    _inherit = 'purchase.order.line'
    _columns = {
        'image_small' : fields.binary('Product Image'),
    }
    def onchange_product_id(self, cr, uid, ids, pricelist_id, product_id, qty, uom_id,
            partner_id, date_order=False, fiscal_position_id=False, date_planned=False,
            name=False, price_unit=False, state='draft', context=None):
        context = context or {}

        res = super(purchase_order_line, self).onchange_product_id(cr, uid, ids, pricelist_id, product_id, qty, uom_id,
            partner_id, date_order=date_order, fiscal_position_id=fiscal_position_id, date_planned=date_planned,
            name=name, price_unit=price_unit, state='draft', context=context)

        product_obj = self.pool.get('product.product')
        product_obj = product_obj.browse(cr, uid, product_id, context=context)

        res['value'].update({'image_small': product_obj.image_small or False})
        return res

in view:

              <record id="view_purchase_order_image_form_inherit" model="ir.ui.view">
            <field name="name">purchase.order.form.sale.image</field>
            <field name="model">purchase.order</field>
            <field name="inherit_id" ref="purchase.purchase_order_form"/>
            <field name="arch" type="xml">
                <xpath expr="//page[@string='Products']/field[@name='order_line']/tree[@string='Purchase Order Lines']/field[@name='price_subtotal']" position="after">
                    <field name="image_small" widget="image" class="oe_avatar"/>
                </xpath>
            </field>
         </record>

All the best

Thanks Vasanth,This working perfectly!!!

aci aisha
on 2/24/15, 3:42 AM
1

deep

--deep--
1617
| 5 4 7
Bengaluru, India
--deep--

Techno-Functional Associate with 6+ years of experience in Odoo (formerly known as OpenERP).

deep
On 2/24/15, 12:41 AM

Yes, create a image field in purchase order line, which is nothing but binary field...

Then Inherit the product onchange_event to include image data in the value list....

However, purchase order line is tree view, hence there exists a module in Odoo 8, google it, and use the same, which gives you an option to add that image widget in the Tree View

Follow the link to download the module: web_tree_image

Also, a thread exists in the forum for the same, Refer this also

yes i referred...is it for sale.order.line? Not for purchase.order.line?

aci aisha
on 2/24/15, 12:48 AM

Hi Deep,This module makes any changes?

aci aisha
on 2/24/15, 12:58 AM

@deep,

I wasn't aware of this OCA module, i'll test it today, thanks.

Luke Branch
on 2/24/15, 9:46 PM

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

2 follower(s)

Stats

Asked: 2/24/15, 12:26 AM
Seen: 1651 times
Last updated: 3/16/15, 8:10 AM