Hello, how do i set the default value for my many2one field. i have this code but it returns and error.
my_field = fields.many2one(
comodel_name="module.i.want",
string="My many2one field",
default= lambda self: self.env['module.i.want'].search([('code', '=', 'model_code_1')], limit=1).id
)
I checked the type of the highlighted code and it returns a type 'function' not an 'integer' (which is the error):
psycopg2.errors.InvalidTextRepresentation: invalid input syntax for type integer: "module_code_1"
Thanks for the help!