fix - improve excel reapopnse on transaction

This commit is contained in:
2026-01-04 14:17:03 +03:30
parent b90fbf462b
commit 99680a080c

View File

@@ -452,7 +452,7 @@ class WareHouseExcelViewSet(viewsets.ViewSet):
).values(
'transaction_id',
'name',
'price'
'unit_price'
)
# Aggregate share totals per transaction
@@ -518,13 +518,13 @@ class WareHouseExcelViewSet(viewsets.ViewSet):
# جمع share totals هر تراکنش
share_values = []
for share_name in share_names:
share_total = sum(i['price'] for i in t_items if i['name'] == share_name)
share_total = sum(i['unit_price'] for i in t_items if i['name'] == share_name)
share_values.append(share_total)
share_column_totals[share_name] += share_total
# جمع کل
total_price += t['price_paid'] or 0
total_weight += sum(i['price'] or 0 for i in t_items) # یا وزن واقعی اگر موجود باشه
total_weight += sum(i['unit_price'] or 0 for i in t_items) # یا وزن واقعی اگر موجود باشه
all_weight += total_weight
list1 = [