When I do model search in Odoo, I randomly encounter extra record which does not exist in the database. For example:
Supposedly this search statement only returns one record
mytable = self.env["my.table"]
mydata = mytable.search([('something_uid', '=', 1)]) #this should only return one
But when I check for mydata.id
I get singleton error because the result is not one. There is an extra record, that when I double check it is not present in the table.
Is it because there is an bug in my code? I discover this in multiple occasions. But I can't point out where there problem is.
Update
I uploaded the code to pastebin.com please have a look https://pastebin.com/gk0rDfuy
PS. I'm using Odoo 8 but I'm curious if later versions of Odoo has similar experience