Skip to content
Snippets Groups Projects
Commit 0d11f15b authored by Alexa Valentová's avatar Alexa Valentová
Browse files

fix permisions reading

parent d98a8381
No related branches found
No related tags found
No related merge requests found
Pipeline #17169 passed
...@@ -122,11 +122,14 @@ class ContractFileAdmin( ...@@ -122,11 +122,14 @@ class ContractFileAdmin(
class ParentContractInlineMixin: class ParentContractInlineMixin:
def get_parent_object_is_editable(self, obj):
return obj.is_editable_without_approve_permission
def has_add_permission(self, request, obj=None): def has_add_permission(self, request, obj=None):
if ( if (
obj is not None obj is not None
and not request.user.has_perm("contracts.edit_when_approved") and not request.user.has_perm("contracts.edit_when_approved")
and not obj.is_editable_without_approve_permission and not self.get_parent_object_is_editable()
): ):
return False return False
...@@ -153,6 +156,9 @@ class ContracteeSignatureRepresentativeInline( ...@@ -153,6 +156,9 @@ class ContracteeSignatureRepresentativeInline(
extra = 1 extra = 1
formset = SingnatureRepresentativeFormSet formset = SingnatureRepresentativeFormSet
def get_parent_object_is_editable(self, obj):
return obj.contract.is_editable_without_approve_permission
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)
formset.request = request formset.request = request
...@@ -170,6 +176,9 @@ class ContracteeSignatureInline(ParentContractInlineMixin, NestedStackedInline): ...@@ -170,6 +176,9 @@ class ContracteeSignatureInline(ParentContractInlineMixin, NestedStackedInline):
class SigneeSignatureRepresentativeInline( class SigneeSignatureRepresentativeInline(
ParentContractInlineMixin, NestedStackedInline ParentContractInlineMixin, NestedStackedInline
): ):
def get_parent_object_is_editable(self, obj):
return obj.contract.is_editable_without_approve_permission
model = SigneeSignatureRepresentative model = SigneeSignatureRepresentative
extra = 0 extra = 0
......
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