From 1b4215836bc349204b5aee4458234be60bcba74e Mon Sep 17 00:00:00 2001 From: ivan deng Date: Sat, 15 Apr 2023 06:56:22 +0800 Subject: [PATCH] =?UTF-8?q?prepare=20#I6VU5L=20=E3=80=90ai=5Fchat=E3=80=91?= =?UTF-8?q?=E9=A2=91=E9=81=93=E5=A4=84=E7=90=86=EF=BC=8C=E6=9D=83=E9=99=90?= =?UTF-8?q?=E4=BB=A5=E5=8F=8A=E8=A7=92=E8=89=B2=E8=AE=BE=E5=AE=9A=20?= =?UTF-8?q?=E7=BD=AE=E9=A1=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app_common/__manifest__.py | 2 +- app_common/models/base.py | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/app_common/__manifest__.py b/app_common/__manifest__.py index b1d6cc8a..ed72a187 100644 --- a/app_common/__manifest__.py +++ b/app_common/__manifest__.py @@ -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', diff --git a/app_common/models/base.py b/app_common/models/base.py index 26d72f9a..6680af91 100644 --- a/app_common/models/base.py +++ b/app_common/models/base.py @@ -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