'Getting error "Unknown error during import: <class Keyerror> : 'Field1' at row 2 resolve other errors first" in odoo 14

I have a custom module in which i want to import some of the updated data but getting an error

Unknown error during import: <class 'KeyError'>: 'field1' at row 2 Resolve other errors first

I am getting this error in some of the fields not all.

Below are the type and description and parameters of the field in which i am getting this error:-

field1 = fields.Many2one(comodel_name="a.b", string="Field1", required=False, )
field2 = fields.Many2one(comodel_name="b.c", string="Field2", required=False, )
field3 = fields.Char('Field3', size=30, required=True)
field4 = fields.Char('Field4', size=30)
field5 = fields.Char('Field5', size=30, required=True)

After including these fields in export and import resolve this issue but if i remove any of the fields in export and import of data gives this issue again. Why is this happening?

Is this error related to migration or something else i am missing? Do anyone have any idea how to solve this issue?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source