fix: 修复空库 migrate 的问题

pull/9008/head
ibuler 2 years ago
parent c9b8c087c7
commit e6d845ae55

@ -60,7 +60,7 @@ class OrgModelMixin(models.Model):
sep = '@' sep = '@'
def save(self, *args, **kwargs): def save(self, *args, **kwargs):
locking_org = getattr(self, 'locking_org', None) locking_org = getattr(self, 'LOCKING_ORG', None)
if locking_org: if locking_org:
org = Organization.get_instance(locking_org) org = Organization.get_instance(locking_org)
else: else:

@ -105,12 +105,11 @@ def tmp_to_builtin_org(system=0, default=0):
def filter_org_queryset(queryset): def filter_org_queryset(queryset):
locking_org = getattr(queryset.model, 'LOCKING_ORG', None) locking_org = getattr(queryset.model, 'LOCKING_ORG', None)
if locking_org:
org = Organization.get_instance(locking_org)
else:
org = get_current_org() org = get_current_org()
if org is None: if locking_org:
kwargs = {'org_id': locking_org}
elif org is None:
kwargs = {} kwargs = {}
elif org.is_root(): elif org.is_root():
kwargs = {} kwargs = {}

Loading…
Cancel
Save