summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2020-03-06 16:28:48 +0100
committerÉtienne Loks <etienne.loks@iggdrasil.net>2020-03-06 16:30:49 +0100
commitfbfcb59984c40f136ebd871041f0e3963f2374e4 (patch)
treec32ec909f00b34c565c440722af6fa5bf110b93e
parent5a325c41f7e87a167f3b7e26cb828852480f1af5 (diff)
downloadIshtar-fbfcb59984c40f136ebd871041f0e3963f2374e4.tar.bz2
Ishtar-fbfcb59984c40f136ebd871041f0e3963f2374e4.zip
Quick actions - tables - edit persons: add organization field
-rw-r--r--CHANGES.md3
-rw-r--r--ishtar_common/forms_common.py17
2 files changed, 19 insertions, 1 deletions
diff --git a/CHANGES.md b/CHANGES.md
index 14ebfc6bb..16c5c7cb0 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -6,7 +6,8 @@ v3.0.4 - 2020-XX-XX
### Features ###
- Quick actions - sheets: add duplicate for site, operation, document and context record
- Quick actions - tables:
- - finds: edit - add appraisal date and treatment emergency fields
+ - find: edit - add appraisal date and treatment emergency fields
+ - person: edit - add organization field
v3.0.3 - 2020-02-24
-------------------
diff --git a/ishtar_common/forms_common.py b/ishtar_common/forms_common.py
index 31eb5c7d2..2b3227f0a 100644
--- a/ishtar_common/forms_common.py
+++ b/ishtar_common/forms_common.py
@@ -575,20 +575,37 @@ class QAPersonFormMulti(QAForm):
base_models = ['qa_title']
associated_models = {
'qa_title': models.TitleType,
+ 'qa_attached_to': models.Organization,
}
MULTI = True
REPLACE_FIELDS = [
'qa_title',
+ 'qa_attached_to'
]
qa_title = forms.ChoiceField(
label=_(u"Title"), required=False
)
+ qa_attached_to = forms.IntegerField(
+ label=_("Organization"),
+ widget=widgets.JQueryAutoComplete(
+ reverse_lazy('autocomplete-organization'),
+ associated_model=models.Organization),
+ validators=[models.valid_id(models.Organization)],
+ required=False
+ )
TYPES = [
FieldType('qa_title', models.TitleType),
]
+ def _get_qa_attached_to(self, value):
+ try:
+ value = models.Organization.objects.get(pk=value).cached_label
+ except models.Organization.DoesNotExist:
+ return ""
+ return value
+
class PersonMergeFormSelection(ManualMerge, forms.Form):
SEARCH_AND_SELECT = True