summaryrefslogtreecommitdiff
path: root/ishtar_common/models.py
diff options
context:
space:
mode:
Diffstat (limited to 'ishtar_common/models.py')
-rw-r--r--ishtar_common/models.py13
1 files changed, 11 insertions, 2 deletions
diff --git a/ishtar_common/models.py b/ishtar_common/models.py
index 72b2ff9cb..94e02aafe 100644
--- a/ishtar_common/models.py
+++ b/ishtar_common/models.py
@@ -3880,7 +3880,14 @@ class Document(
)
return list(set(operations))
- def get_index_operation(self):
+ def get_index_operation_source_type_code(self):
+ if not self.source_type or not self.source_type.code:
+ return
+ return self.get_index_operation(
+ extra_filters={"source_type__code": self.source_type.code}
+ )
+
+ def get_index_operation(self, extra_filters=None):
operations = self.get_related_operation_ids()
if len(operations) != 1:
return
@@ -3892,8 +3899,10 @@ class Document(
| Q(context_records__operation_id=current_operation)
| Q(finds__base_finds__context_record__operation_id=current_operation)
)
- .order_by("-custom_index")
)
+ if extra_filters:
+ q = q.filter(**extra_filters)
+ q = q.order_by("-custom_index")
current_index = None
for doc in q.all():
if not doc.custom_index: