forked from DGNum/gestioCOF
Renvoie les transferts dans l'historique
This commit is contained in:
parent
a3b0ea9b8d
commit
bf117ec070
1 changed files with 31 additions and 0 deletions
|
@ -1515,6 +1515,37 @@ def history_json(request):
|
|||
)
|
||||
opegroup_dict["opes"].append(ope_dict)
|
||||
opegroups_list.append(opegroup_dict)
|
||||
for transfergroup in transfergroups:
|
||||
if transfergroup.filtered_transfers:
|
||||
transfergroup_dict = {
|
||||
"type": "transfergroup",
|
||||
"id": transfergroup.id,
|
||||
"at": transfergroup.at,
|
||||
"comment": transfergroup.comment,
|
||||
"opes": [],
|
||||
}
|
||||
if request.user.has_perm("kfet.is_team"):
|
||||
transfergroup_dict["valid_by__trigramme"] = (
|
||||
transfergroup.valid_by and transfergroup.valid_by.trigramme or None
|
||||
)
|
||||
|
||||
for transfer in transfergroup.filtered_transfers:
|
||||
transfer_dict = {
|
||||
"id": transfer.id,
|
||||
"amount": transfer.amount,
|
||||
"canceled_at": transfer.canceled_at,
|
||||
"from_acc": transfer.from_acc.trigramme,
|
||||
"to_acc": transfer.to_acc.trigramme,
|
||||
}
|
||||
if request.user.has_perm("kfet.is_team"):
|
||||
transfer_dict["canceled_by__trigramme"] = (
|
||||
transfer.canceled_by and transfer.canceled_by.trigramme or None
|
||||
)
|
||||
transfergroup_dict["opes"].append(transfer_dict)
|
||||
opegroups_list.append(transfergroup_dict)
|
||||
|
||||
opegroups_list.sort(key=lambda group: group["at"])
|
||||
|
||||
return JsonResponse({"opegroups": opegroups_list})
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue