fix common

This commit is contained in:
ivan deng
2021-05-08 18:28:17 +08:00
parent 00b9ba262e
commit d9bf2f1beb
2 changed files with 2 additions and 1 deletions

View File

@@ -14,7 +14,7 @@ class Base(models.AbstractModel):
if self._context.get(fieldname) or self._context.get('default_%s' % fieldname):
return self._context.get(fieldname) or self._context.get('default_%s' % fieldname)
else:
rec = self.env[self._fields[fieldname].comodel_name].search(domain, limit=1)
rec = self.env[self._fields[fieldname].comodel_name].sudo().search(domain, limit=1)
return rec.id if rec else False
return False