summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGES.md3
-rw-r--r--archaeological_context_records/models.py4
-rw-r--r--archaeological_operations/models.py4
-rw-r--r--archaeological_warehouse/forms.py3
-rw-r--r--archaeological_warehouse/models.py5
-rw-r--r--ishtar_common/views_item.py6
6 files changed, 14 insertions, 11 deletions
diff --git a/CHANGES.md b/CHANGES.md
index 47055895b..de2b73b93 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -6,7 +6,7 @@ date: 2022-08-05
Ishtar changelog
================
-v4.0.15 - 2022-
+v4.0.15 - 2022-08-30
--------------------
### Features ###
@@ -15,6 +15,7 @@ v4.0.15 - 2022-
### Bug fix ###
- Fix INSEE number generation on error with years
+- Fix many count search such has "has-finds"
v4.0.14 - 2022-08-05
--------------------
diff --git a/archaeological_context_records/models.py b/archaeological_context_records/models.py
index e279c55fa..f0a277678 100644
--- a/archaeological_context_records/models.py
+++ b/archaeological_context_records/models.py
@@ -555,7 +555,7 @@ class ContextRecord(
"operation_id": "operation_id",
"unit__label": "unit__label",
}
- MANY_COUNTED_FIELDS = ["base_finds"]
+ MANY_COUNTED_FIELDS = ["base_finds__isnull"]
REVERSED_BOOL_FIELDS = [
"documents__image__isnull",
"documents__associated_file__isnull",
@@ -612,7 +612,7 @@ class ContextRecord(
"parcel__cached_label__iexact",
),
"has_finds": SearchAltName(
- pgettext_lazy("key for text search", "has-finds"), "base_finds"
+ pgettext_lazy("key for text search", "has-finds"), "base_finds__isnull"
),
"cr_relation_types": SearchAltName(
pgettext_lazy("key for text search", "record-relation-type"),
diff --git a/archaeological_operations/models.py b/archaeological_operations/models.py
index ae52e5cbe..bb41848a5 100644
--- a/archaeological_operations/models.py
+++ b/archaeological_operations/models.py
@@ -923,7 +923,7 @@ class Operation(
"documentation_received",
"finds_received",
]
- MANY_COUNTED_FIELDS = ["context_record__base_finds"]
+ MANY_COUNTED_FIELDS = ["context_record__base_finds__isnull"]
REVERSED_BOOL_FIELDS = [
"documents__image__isnull",
"documents__associated_file__isnull",
@@ -1154,7 +1154,7 @@ class Operation(
),
"has_finds": SearchAltName(
pgettext_lazy("key for text search", "has-finds"),
- "context_record__base_finds",
+ "context_record__base_finds__isnull",
),
"finds_deadline_before": SearchAltName(
pgettext_lazy("key for text search", "finds-deadline-before"),
diff --git a/archaeological_warehouse/forms.py b/archaeological_warehouse/forms.py
index 57fc31f4f..e942878a7 100644
--- a/archaeological_warehouse/forms.py
+++ b/archaeological_warehouse/forms.py
@@ -512,7 +512,8 @@ class ContainerSelect(DocumentItemSelect):
old_reference = forms.CharField(label=_("Old reference"))
comment = forms.CharField(label=_("Comment"))
contain_containers = forms.NullBooleanField(label=_("Contain containers"))
- empty = forms.NullBooleanField(label=_("Currently empty"))
+ ## to be rethink: the current request if it has got finds directly inside
+ # empty = forms.NullBooleanField(label=_("Currently empty"))
is_stationary = forms.NullBooleanField(label=_("Is stationary"))
parent = forms.IntegerField(
label=_("Parent container"),
diff --git a/archaeological_warehouse/models.py b/archaeological_warehouse/models.py
index 2e2aae732..9a8bc86c2 100644
--- a/archaeological_warehouse/models.py
+++ b/archaeological_warehouse/models.py
@@ -1004,7 +1004,8 @@ class Container(
pgettext_lazy("key for text search", "find-description"),
"finds__description__iexact",
),
- "empty": SearchAltName(pgettext_lazy("key for text search", "empty"), "finds"),
+ "empty": SearchAltName(pgettext_lazy("key for text search", "empty"),
+ "finds__isnull"),
"parent": SearchAltName(
pgettext_lazy("key for text search", "parent-container"),
"parent__cached_label__iexact",
@@ -1025,7 +1026,7 @@ class Container(
"documents__associated_url__isnull",
]
BOOL_FIELDS = LightHistorizedItem.BOOL_FIELDS + ["container_type__stationary"]
- REVERSED_MANY_COUNTED_FIELDS = ["finds", "finds_ref"]
+ REVERSED_MANY_COUNTED_FIELDS = ["finds__isnull", "finds_ref"]
ALT_NAMES.update(LightHistorizedItem.ALT_NAMES)
ALT_NAMES.update(DocumentItem.ALT_NAMES)
diff --git a/ishtar_common/views_item.py b/ishtar_common/views_item.py
index 5d1ed582a..b1a7e397d 100644
--- a/ishtar_common/views_item.py
+++ b/ishtar_common/views_item.py
@@ -885,10 +885,10 @@ def _manage_many_counted_fields(fields, reversed_fields, dct, excluded_dct):
if reversed_fields and k in reversed_fields:
dct[k] = True if not dct[k] else None
if dct[k]:
- dct.pop(k)
- excluded_dct[k] = None
+ dct[k] = False
else:
- dct[k] = None
+ dct.pop(k)
+ excluded_dct[k] = False
today_lbl = pgettext_lazy("key for text search", "today")