Adding image while creating a new product

Asked by Bushair

Hi,
Can you please tell me the procedure to create an image while adding a new products.
For example say, am creating a new product named LaptopComputer with all the information related to this product.
How can i attach an image of laptopcomputer to this product?

Thanks
Bushair

Question information

Language:
English Edit question
Status:
Answered
For:
Odoo Addons (MOVED TO GITHUB) Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Vinay Rana (OpenERP) (vra-openerp) said :
#1

Hello,

Simply you need to add one more field in product object by inheritance which binary type like res.company object contains logo.

Hope this will help you.
Thanks.

Revision history for this message
Bushair (bushairka) said :
#2

Hi,
Thank you very much for the information.

Can you please let me know how to add the field in product object by inheritance for this?

also please let me know where should i store the images/logos?

thanks in advance.
Bushair

Revision history for this message
Vinay Rana (OpenERP) (vra-openerp) said :
#3

Hello,

By Following way:

In python file:
class product_product(osv.osv):
    _inherit = "product.product"
    _columns = {
                    'image': fields.binary('Image'),
    }

sale_order()

In xml file:
        <record id="product_image_form_view" model="ir.ui.view">
            <field name="name">product.image.form.inherit</field>
            <field name="model">product.product</field>
            <field name="type">form</field>
            <field name="inherit_id" ref="product.product_normal_form_view"/>
            <field name="arch" type="xml">
                <notebook position="inside">
                    <page string="Image">
                        <field name="image" nolabel="1"/>
                    </page>
                </notebook>
            </field>
        </record>

Hope now you will definitely done this.

Thanks.

Revision history for this message
Bushair (bushairka) said :
#4

Hi,
Thank you very much .
Where should i save the images?
i mean the location of images...

Thanks
Bushair

Revision history for this message
Vinay Rana (OpenERP) (vra-openerp) said :
#5

Hello,

I have added one field image which is binary type contains the image you can add from product form view and it will be saved in product_product table.
You can check similar thing in company object form which contains logo field as a binary type from following menu :Administration/Users/Company's Structure/Companies.

Hope you understand.

Thanks.

Can you help with this problem?

Provide an answer of your own, or ask Bushair for more information if necessary.

To post a message you must log in.