Hi,
You can import data using scripts, so you need to add a wizard action and the action contains files when uploading the file add a button to import the record, and you must add functionality on the button function.
class DynamicField(models.TransientModel):
_name = 'import.data'
_description = 'Import Data'
file = fields.Binary('File')
def function_name(self):
csv_data = base64.b64decode(self.file)
data_file = io.StringIO(csv_data.decode("utf-8"))
csv_reader = csv.reader(data_file, delimiter=',')
keys = ['id', 'value1', 'value2']
file_reader = []
file_reader.extend(csv_reader)
for i in range(len(file_reader)):
field = list(map(str, file_reader[i]))
values = dict(zip(keys, field))
if values:
if i == 0:
continue
else:
record = self.env.ref(values['id'])
//You can add the functions here
In this case, you must add the CSV file and the first column contains the external id, using self.env.ref(values['id']) the id contains the external id and you will get the particular data-id on the record variable, as per the value you will get the database id and further information
Regards