Ir al contenido
Menú
Se marcó esta pregunta
2 Respuestas
6706 Vistas

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

Avatar
Descartar

@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.

Autor

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

Autor

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

Autor

& 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,

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.

Autor

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

Autor

Can u give ur email id to discuss more

@aci,

Please check my email address on the github profile here:

https://github.com/odoocommunitywidgets

Autor

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

Mejor respuesta

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

Avatar
Descartar
Autor

Thanks Vasanth,This working perfectly!!!

Mejor respuesta

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

Avatar
Descartar
Autor

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

Autor

Hi Deep,This module makes any changes?

@deep,

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