Compare commits

..

2 commits

Author SHA1 Message Date
54998ab9d0
explicitely convert is_accepted to boolean
All checks were successful
Tests / test (push) Successful in 31s
The is_accepted property returns self.accepted_by or self.accepted_at.
When accepted_by is a User object (not None), it returns the User object
instead of a boolean.

The Django admin's boolean field renderer expects a boolean value
(True, False, or None), not a User object.
2025-10-17 10:40:00 +02:00
014e88aa24
remove the help text about billing entity being read only
The issue is that when obj.has_inherited_billing_entity is True, the code adds
"billing_entity" to the readonly fields.

When a field is marked as readonly, Django may exclude it from form.base_fields,
which causes a KeyError when trying to access it.
2025-10-17 10:35:47 +02:00
2 changed files with 1 additions and 11 deletions

View file

@ -73,16 +73,6 @@ class OrganizationAdmin(admin.ModelAdmin):
return readonly_fields
def get_form(self, request, obj=None, **kwargs):
form = super().get_form(request, obj, **kwargs)
if obj and obj.has_inherited_billing_entity:
form.base_fields["billing_entity"].help_text = _(
"This billing entity is inherited from the organization's origin and cannot be modified."
)
return form
@admin.register(BillingEntity)
class BillingEntityAdmin(admin.ModelAdmin):

View file

@ -485,7 +485,7 @@ class OrganizationInvitation(ServalaModelMixin, models.Model):
def is_accepted(self):
# We check both accepted_by and accepted_at to avoid a deleted user
# freeing up an invitation
return self.accepted_by or self.accepted_at
return bool(self.accepted_by or self.accepted_at)
@property
def can_be_accepted(self):