feat(api): Enable fetching related ticket metadata for the other side of the related ticket

ref: #466 #467 nofusscomputing/centurion_erp_ui#40
This commit is contained in:
2025-01-09 02:53:52 +09:30
parent 229014eb8c
commit f9d82a5e92

View File

@ -309,6 +309,10 @@ class ReactUIMetadata(OverRideJSONAPIMetadata):
linked_models = re.findall(r'\s\$(?P<model_type>[a-z_]+)-(?P<model_id>\d+)[\s|\n]?', ' ' + str(value) + ' ')
linked_tickets = re.findall(r'(?P<ticket>#(?P<number>\d+))', str(value))
if(getattr(obj, 'from_ticket_id_id', None)):
linked_tickets += re.findall(r'(?P<ticket>#(?P<number>\d+))', '#' + str(obj.to_ticket_id_id))
for ticket, number in linked_tickets: