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