Skip to Content
Menu
This question has been flagged
6 Replies
8976 Views

Hi,

I'm trying to add products to my shop. I need to add products which have a lot of variants.

Here is an example of a product I need to import : https://drive.google.com/open?id=1TaQ7U1mVcXg3Ug2LgoBXZSLfA8NRsEdg

Is it too long? Why Odoo doesn't want to import this file?
I get a message of memory or odoo doesn't simply do the import.

Thanks a lot,

Thomas.

Avatar
Discard
Best Answer

Hi,

To avoid memory issue, you can create your own import python script which will do import for you.(BTW if you search over google you can get readymade :P)

Avatar
Discard

Memory issues + the fact that making a Python import script will be a lot easier and robuster than the CSV imports. Columns tend to mess up in imports while that is not the case with a Python script.

Best Answer

Part of memory issues might comes from web server or from a slow Odoo because of lack of workers setup.

Did you read the docs about deploying Odoo ?

If you still have problems, you can decrease the cpu and memory load this way :

In you current import, Odoo creates products and missing attributes on the fly and find the others using their name. You could import things in 3 steps :

  1. import products without attributes

  2. import attributes only

  3. export products name (you will get ID and name), attribute name ( you will get ID and name) and update your sheet with IDs for products and attributes. With a database or the OpenRefine tool this is quickly done.


Avatar
Discard
Best Answer

Hello BeWheels,

Here are the community modules which might help you out.
You can easily create variants using this : 

https://www.odoo.com/apps/modules/10.0/product_configurator/

https://www.odoo.com/apps/modules/10.0/website_product_configurator/


Hope this helps you!
Regards,
Parth

Avatar
Discard
Best Answer

Hello,


If You Want To import Product With Its Attributes First, You have to Import Product After That You Can Add one Button on Product e.g" Import Variants ".

Code Hint:

class ProductWizard(models.TransientModel):

    _name = 'product.varient'

    Product_file = fields.Binary(string="Select File")

    @api.multi

    def import_account_move_lines(self):

        keys = ['']# Use Field Here Which You want to import

        data = base64.b64decode(self.account_file)

        file_input = cStringIO.StringIO(data)

        file_input.seek(0)

        reader_info = []

        reader = csv.reader(file_input, delimiter=',')

        try:

            reader_info.extend(reader)

        except Exception:

            raise exceptions.Warning(_("Not a Valid File!"))

        values = {}

        for i in range(len(reader_info)):

            field = map(str, reader_info[i])

            values = dict(zip(keys, field))

            if values:

                if values['Account'] == 'Account':

                    continue

                res=self.create_move_lines(values)


    @api.multi

    def create_variant_lines(self,values):

        example_field_id=self.env[''].browse(self._context.get('active_id'))# Object name here self.env['']

        example_field = values.get('')#field

        example_field = values.get('')#field

        lines = move_lines.create({

                            #Your code of Create

        })


Thanks

Avatar
Discard
Author Best Answer

 Thanks for your answers. But write a python script seems a lot too difficult for me. Are there tutorials?
Thanks. 

Avatar
Discard