prepare #I6VU5L 【ai_chat】频道处理,权限以及角色设定 置顶

This commit is contained in:
ivan deng
2023-04-15 06:56:22 +08:00
parent 54df2d515b
commit 1b4215836b
2 changed files with 3 additions and 1 deletions

View File

@@ -33,7 +33,7 @@
{
'name': "Sunpop Odooapp Common Func",
'version': '16.23.03.04',
'version': '16.23.04.15',
'author': 'Sunpop.cn',
'category': 'Base',
'website': 'https://www.sunpop.cn',

View File

@@ -65,6 +65,8 @@ 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:
if not domain:
domain = self._fields[fieldname].domain or []
rec = self.env[self._fields[fieldname].comodel_name].sudo().search(domain, limit=1)
return rec.id if rec else False
return False