Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions poms/transactions/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ def __init__( # noqa: PLR0913, PLR0915
self.complex_transaction_status = complex_transaction_status
self.transactions_errors = transactions_errors or []
self.recalculate_inputs = recalculate_inputs or []
self.source = source # JSON object that contains source dictionary from broker
self.source_data_dict = source # JSON object that contains source dictionary from broker
self.uniqueness_reaction = uniqueness_reaction or (self.transaction_type.transaction_unique_code_options)
self._now = now or date_now()
self.next_transaction_order = transaction_order_gen or self._next_transaction_order_default
Expand Down Expand Up @@ -2926,8 +2926,8 @@ def process(self): # noqa: PLR0915
if self.complex_transaction_status is not None:
self.complex_transaction.status_id = self.complex_transaction_status

if self.source:
self.complex_transaction.source = self.source
if self.source_data_dict:
self.complex_transaction.source_data_dict = self.source_data_dict

if self.complex_transaction.transaction_unique_code:
count = (
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Generated by Django 4.2.22 on 2026-01-20 19:37

from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

dependencies = [
('provenance', '0003_platformversion_created_at_and_more'),
('transactions', '0042_complextransaction_actual_at_and_more'),
]

operations = [
migrations.AddField(
model_name='complextransaction',
name='source',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='provenance.source', verbose_name='source'),
),
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 4.2.22 on 2026-01-20 19:46

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('transactions', '0043_remove_complextransaction_source_data_and_more'),
]

operations = [
migrations.AlterField(
model_name='complextransaction',
name='source_data',
field=models.JSONField(blank=True, null=True, verbose_name='source data'),
),
]
8 changes: 4 additions & 4 deletions poms/transactions/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -2798,18 +2798,18 @@ class ComplexTransaction(TimeStampedModel, ObjectStateModel, ProvenanceModel):
blank=True,
verbose_name=gettext_lazy("execution log"),
)
source_data = models.TextField(
source_data = models.JSONField(
null=True,
blank=True,
verbose_name=gettext_lazy("source data"),
)

@property
def source(self):
def source_data_dict(self):
return None if self.source_data is None else json.loads(self.source_data)

@source.setter
def source(self, value):
@source_data_dict.setter
def source_data_dict(self, value):
if value is None:
self.source_data = None
else:
Expand Down
4 changes: 2 additions & 2 deletions poms/transactions/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -3868,7 +3868,7 @@ class ComplexTransactionSerializer(
transaction_type = serializers.PrimaryKeyRelatedField(read_only=True)
transactions = serializers.PrimaryKeyRelatedField(read_only=True, many=True)
recon_fields = ReconciliationComplexTransactionFieldSerializer(required=False, many=True)
source = serializers.JSONField(read_only=True, allow_null=True)
# source = serializers.JSONField(read_only=True, allow_null=True)
inputs = ComplexTransactionInputSerializer(many=True)

def __init__(self, *args, **kwargs):
Expand Down Expand Up @@ -3952,7 +3952,7 @@ class Meta:
"user_date_5",
"recon_fields",
"execution_log",
"source",
"source_data",
"inputs",
]

Expand Down