Skip to Content
Menu
This question has been flagged
2146 Views

Hi, 

I want import public_categ_ids(many2many) from xlsx into product.template. 

field public_categ_ids in file xlsx containing comma. example: 2490,2478
in time import iget error: invalid literal for int() with base 10

python code:

   .....
   line = list(map(lambda row:isinstance(row.value, bytes) and row.value.encode('utf-8') or str(row.value), sheet.row(row_no)))

values.update({
                                        'code' : line[0],
                                        'categ_ids' : line[1],                                                                              
                                                    })
product_obj = self.env['product.template'].search([('id', '=', int(float(values.get('code'))))])
categ_ids=values.get('categ_ids')
product_obj.write({ 'public_categ_ids': [(4, [int(x) for x in categ_ids] )] })


how import field many2many(public_categ_ids) contaning comma from xlsx?

please help me, thanks.









Avatar
Discard