Skip to content

Commit 581e1c3

Browse files
authored
Merge pull request #157 from finmars-platform/PLAT-1995
Plat 1995
2 parents ef35d7c + eaa4118 commit 581e1c3

5 files changed

Lines changed: 47 additions & 9 deletions

File tree

poms/transactions/handlers.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ def __init__( # noqa: PLR0913, PLR0915
140140
self.complex_transaction_status = complex_transaction_status
141141
self.transactions_errors = transactions_errors or []
142142
self.recalculate_inputs = recalculate_inputs or []
143-
self.source = source # JSON object that contains source dictionary from broker
143+
self.source_data_dict = source # JSON object that contains source dictionary from broker
144144
self.uniqueness_reaction = uniqueness_reaction or (self.transaction_type.transaction_unique_code_options)
145145
self._now = now or date_now()
146146
self.next_transaction_order = transaction_order_gen or self._next_transaction_order_default
@@ -2926,8 +2926,8 @@ def process(self): # noqa: PLR0915
29262926
if self.complex_transaction_status is not None:
29272927
self.complex_transaction.status_id = self.complex_transaction_status
29282928

2929-
if self.source:
2930-
self.complex_transaction.source = self.source
2929+
if self.source_data_dict:
2930+
self.complex_transaction.source_data_dict = self.source_data_dict
29312931

29322932
if self.complex_transaction.transaction_unique_code:
29332933
count = (
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Generated by Django 4.2.22 on 2026-01-20 19:37
2+
3+
from django.db import migrations, models
4+
import django.db.models.deletion
5+
6+
7+
class Migration(migrations.Migration):
8+
9+
dependencies = [
10+
('provenance', '0003_platformversion_created_at_and_more'),
11+
('transactions', '0042_complextransaction_actual_at_and_more'),
12+
]
13+
14+
operations = [
15+
migrations.AddField(
16+
model_name='complextransaction',
17+
name='source',
18+
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='provenance.source', verbose_name='source'),
19+
),
20+
]
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Generated by Django 4.2.22 on 2026-01-20 19:46
2+
3+
from django.db import migrations, models
4+
5+
6+
class Migration(migrations.Migration):
7+
8+
dependencies = [
9+
('transactions', '0043_remove_complextransaction_source_data_and_more'),
10+
]
11+
12+
operations = [
13+
migrations.AlterField(
14+
model_name='complextransaction',
15+
name='source_data',
16+
field=models.JSONField(blank=True, null=True, verbose_name='source data'),
17+
),
18+
]

poms/transactions/models.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2798,18 +2798,18 @@ class ComplexTransaction(TimeStampedModel, ObjectStateModel, ProvenanceModel):
27982798
blank=True,
27992799
verbose_name=gettext_lazy("execution log"),
28002800
)
2801-
source_data = models.TextField(
2801+
source_data = models.JSONField(
28022802
null=True,
28032803
blank=True,
28042804
verbose_name=gettext_lazy("source data"),
28052805
)
28062806

28072807
@property
2808-
def source(self):
2808+
def source_data_dict(self):
28092809
return None if self.source_data is None else json.loads(self.source_data)
28102810

2811-
@source.setter
2812-
def source(self, value):
2811+
@source_data_dict.setter
2812+
def source_data_dict(self, value):
28132813
if value is None:
28142814
self.source_data = None
28152815
else:

poms/transactions/serializers.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3868,7 +3868,7 @@ class ComplexTransactionSerializer(
38683868
transaction_type = serializers.PrimaryKeyRelatedField(read_only=True)
38693869
transactions = serializers.PrimaryKeyRelatedField(read_only=True, many=True)
38703870
recon_fields = ReconciliationComplexTransactionFieldSerializer(required=False, many=True)
3871-
source = serializers.JSONField(read_only=True, allow_null=True)
3871+
# source = serializers.JSONField(read_only=True, allow_null=True)
38723872
inputs = ComplexTransactionInputSerializer(many=True)
38733873

38743874
def __init__(self, *args, **kwargs):
@@ -3952,7 +3952,7 @@ class Meta:
39523952
"user_date_5",
39533953
"recon_fields",
39543954
"execution_log",
3955-
"source",
3955+
"source_data",
39563956
"inputs",
39573957
]
39583958

0 commit comments

Comments
 (0)