This question has been flagged
3 Replies
6894 Views

Because quiet often importing data from external sources, decided to create a module as flexible as possible so I can change set of fields depending on CSV source and map it into product_template table columns.

So i have a source selector [ebay, opencart, stock, end more], choosing source, loading data from CSV,  (product_name=> name, price=>sale_price ... etc) into fields.

Once CSV is loaded i can use all the records to create new product by selectiong records from list or all in one go.

self.env['product.template'].create({'name': record.product_name,'sale_price': record.price,.......})

The only problem I have now is: if I add image_stream to the query/API it generate an error, once I remove image_stream everything works fine.

The question is: how can I use image binary stream(converted image) while new product is created?

Tried already a few methods but regardless of what I'm doing it still displaying error:

2016-05-11 08:18:05,679 49329 ERROR Farmore openerp.http: Exception during JSON request handling.

MissingError: ('MissingError', u'One of the documents you are trying to access has been deleted, please try again after refreshing.')

Avatar
Discard
Author Best Answer

This is my import product page view and here the product image is displayed. Just abowe there is a button "ProCreator" clicking this button new product is created with all required data ...... unfortunately without image and I'm getting this error:

Creating product!

2016-05-11 08:18:05,679 49329 ERROR Farmore openerp.http: Exception during JSON request handling.

MissingError: ('MissingError', u'One of the documents you are trying to access has been deleted, please try again after refreshing.')

Maybe because the image is already converted and while product is created "create" method is trying to do it again ?

Apart of that it works pretty well ;)


Problem solved, another module causing this issue.

Now it works just fine!

Thank You Pawan!

Avatar
Discard
Best Answer

I'm interested by the response cause I want to do the same thing.

Avatar
Discard
Best Answer

If your question is how to create products by importing a csv file then the answer is yes.I do it frequently. 


The matching of the csv file columns with the Odoo field names is essential;

to avoid errors, start exporting a list of articles with all the fields that you need for the import. Some fields are mandatory (name etc...); they are colored in blue in the exporting interface.

Then reuse this exported format with your new products.

You will import product, not variants


Avatar
Discard
Author

Read changed post above.

Author

When you importing data from CSV into your products, what is the content of the image column ? Is it a link yo file ? is it an image itself ?