Skip to content
Snippets Groups Projects
Verified Commit 989c6ad9 authored by Alexa Valentová's avatar Alexa Valentová
Browse files

default to true

parent cdf5880f
No related branches found
No related tags found
No related merge requests found
Pipeline #17478 passed
...@@ -123,7 +123,10 @@ class ContractFileAdmin( ...@@ -123,7 +123,10 @@ class ContractFileAdmin(
class ParentContractInlineMixin: class ParentContractInlineMixin:
def get_parent_object_is_editable(self, obj): def get_parent_object_is_editable(self, obj):
return obj.is_editable_without_approve_permission if hasattr(obj, "is_editable_without_approve_permission"):
return obj.is_editable_without_approve_permission
return False
def has_add_permission(self, request, obj=None): def has_add_permission(self, request, obj=None):
if ( if (
...@@ -165,7 +168,12 @@ class ContracteeSignatureRepresentativeInline( ...@@ -165,7 +168,12 @@ class ContracteeSignatureRepresentativeInline(
elif hasattr(obj, "is_editable_without_approve_permission"): elif hasattr(obj, "is_editable_without_approve_permission"):
return obj.is_editable_without_approve_permission return obj.is_editable_without_approve_permission
return False # FIXME: We MUST return a True value here, since the admin seemingly
# creates the parent ContracteeSignature with empty data, then
# validates this inline before actually filling any fields.
# Thus, it has no `contract` attribute.
return True
def get_formset(self, request, obj=None, **kwargs): def get_formset(self, request, obj=None, **kwargs):
formset = super().get_formset(request, obj, **kwargs) formset = super().get_formset(request, obj, **kwargs)
...@@ -193,7 +201,12 @@ class SigneeSignatureRepresentativeInline( ...@@ -193,7 +201,12 @@ class SigneeSignatureRepresentativeInline(
elif hasattr(obj, "is_editable_without_approve_permission"): elif hasattr(obj, "is_editable_without_approve_permission"):
return obj.is_editable_without_approve_permission return obj.is_editable_without_approve_permission
return False # FIXME: We MUST return a True value here, since the admin seemingly
# creates the parent ContracteeSignature with empty data, then
# validates this inline before actually filling any fields.
# Thus, it has no `contract` attribute.
return True
model = SigneeSignatureRepresentative model = SigneeSignatureRepresentative
extra = 0 extra = 0
......
...@@ -993,7 +993,10 @@ class ContracteeSignature(models.Model): ...@@ -993,7 +993,10 @@ class ContracteeSignature(models.Model):
) )
def __str__(self) -> str: def __str__(self) -> str:
return f"{str(self.contractee)} - {self.date}" if hasattr(self, "contractee"):
return f"{str(self.contractee)} - {self.date}"
else:
return f"Bez smluvní strany - {self.date}"
class Meta: class Meta:
app_label = "contracts" app_label = "contracts"
...@@ -1030,7 +1033,10 @@ class SigneeSignature(models.Model): ...@@ -1030,7 +1033,10 @@ class SigneeSignature(models.Model):
) )
def __str__(self) -> str: def __str__(self) -> str:
return f"{str(self.signee)} - {self.date}" if hasattr(self, "signee"):
return f"{str(self.signee)} - {self.date}"
else:
return f"Bez smluvní strany - {self.date}"
class Meta: class Meta:
app_label = "contracts" app_label = "contracts"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment