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.
This commit is contained in:
Tobias Brunner 2025-10-17 10:35:47 +02:00
parent 8ba9787d4b
commit 014e88aa24
Signed by: tobru
SSH key fingerprint: SHA256:kOXg1R6c11XW3/Pt9dbLdQvOJGFAy+B2K6v6PtRWBGQ

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):