Skip to content

Commit 7c90e07

Browse files
authored
Merge pull request #321 from MULTidll/main
Implements the requested enhancements described in issue #307 and Resolves issues found in PR #318
2 parents f975acd + 9a4f927 commit 7c90e07

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

crm/site/requestadmin.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from django.contrib import messages
44
from django.contrib.auth import get_user_model
55
from django.core.handlers.wsgi import WSGIRequest
6+
from django.forms.widgets import HiddenInput
67
from django.http import HttpResponseRedirect
78
from django.utils.html import format_html
89
from django.utils.translation import gettext_lazy as _
@@ -192,12 +193,21 @@ def changelist_view(self, request, extra_context=None):
192193

193194
def get_form(self, request, obj=None, **kwargs):
194195
form = super().get_form(request, obj, **kwargs)
196+
197+
if obj and getattr(obj, "deal", None):
198+
if "duplicate" in form.base_fields:
199+
form.base_fields["duplicate"].widget = HiddenInput()
200+
if "case" in form.base_fields:
201+
form.base_fields["case"].widget = HiddenInput()
202+
195203
if request.method == "POST" and '_create-deal' in request.POST:
196204
department_id = request.user.department_id
197205
works_globally = Department.objects.get(
198-
id=department_id).works_globally
206+
id=department_id
207+
).works_globally
199208
if works_globally:
200209
form.country_must_be_specified = True
210+
201211
return form
202212

203213
def get_changeform_initial_data(self, request):

0 commit comments

Comments
 (0)