changes
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
18
app/migrations/0366_payment_schedule_batch_date.py
Normal file
18
app/migrations/0366_payment_schedule_batch_date.py
Normal file
@@ -0,0 +1,18 @@
|
||||
# Generated by Django 5.1.7 on 2026-01-26 03:50
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('app', '0365_payment_schedule_penalty_paid_and_more'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='payment_schedule',
|
||||
name='batch_date',
|
||||
field=models.DateField(null=True),
|
||||
),
|
||||
]
|
||||
@@ -1700,6 +1700,7 @@ class Payment_Schedule(AutoCodeModel):
|
||||
updater = models.ForeignKey(User, null=False, related_name='+', on_delete=models.PROTECT)
|
||||
entry = models.JSONField(null=True)
|
||||
detail = models.JSONField(null=True)
|
||||
batch_date = models.DateField(null=True)
|
||||
ovd_days = models.IntegerField(null=True)
|
||||
penalty_amount = models.DecimalField(null=True, max_digits=15, decimal_places=2)
|
||||
penalty_paid = models.DecimalField(null=True, max_digits=15, decimal_places=2)
|
||||
|
||||
@@ -321,17 +321,34 @@ def resolve_value(expr, context):
|
||||
# =============================================
|
||||
# $append(list, element)
|
||||
if re.match(r'^\$append\(', expr, re.IGNORECASE):
|
||||
match = re.match(r'^\$append\((.*)\)$', expr, re.IGNORECASE)
|
||||
match = re.match(r"^\$append\(([^,]+),\s*(.+)\)$", expr, re.DOTALL)
|
||||
if match:
|
||||
args = split_args(match.group(1))
|
||||
if len(args) == 2:
|
||||
target_list = resolve_value(args[0], context)
|
||||
element = resolve_value(args[1], context)
|
||||
if not isinstance(target_list, list):
|
||||
list_expr = match.group(1).strip()
|
||||
element_expr = match.group(2).strip()
|
||||
|
||||
# 1. Resolve the list
|
||||
target_list = resolve_value(list_expr, context)
|
||||
if target_list is None:
|
||||
target_list = []
|
||||
result = list(target_list)
|
||||
result.append(element)
|
||||
return result
|
||||
|
||||
# Ensure it's a copy so we don't modify the original context variable directly
|
||||
target_list = list(target_list)
|
||||
|
||||
# 2. Resolve the element
|
||||
resolved_element = resolve_value(element_expr, context)
|
||||
|
||||
if isinstance(resolved_element, str):
|
||||
try:
|
||||
import json
|
||||
element_to_append = json.loads(resolved_element)
|
||||
except json.JSONDecodeError:
|
||||
element_to_append = resolved_element
|
||||
else:
|
||||
element_to_append = resolved_element
|
||||
|
||||
target_list.append(element_to_append)
|
||||
return target_list
|
||||
|
||||
|
||||
# $first(list), $last(list)
|
||||
if re.match(r'^\$(first|last)\(', expr, re.IGNORECASE):
|
||||
|
||||
Reference in New Issue
Block a user