forked from DGNum/gestioCOF
adapt history view
This commit is contained in:
parent
eac6c42041
commit
8eae3cee7f
1 changed files with 11 additions and 11 deletions
|
@ -1301,21 +1301,21 @@ def history_json(request):
|
||||||
|
|
||||||
|
|
||||||
# Construction de la réponse
|
# Construction de la réponse
|
||||||
opegroups_list = []
|
ope_list = []
|
||||||
for opegroup in opegroups:
|
for opegroup in opegroups:
|
||||||
opegroup_dict = {
|
opegroup_dict = {
|
||||||
'id' : opegroup.id,
|
'id' : opegroup.id,
|
||||||
'amount' : opegroup.amount,
|
'amount' : opegroup.amount,
|
||||||
'at' : opegroup.at,
|
'at' : opegroup.at,
|
||||||
'checkout_id': opegroup.checkout_id,
|
|
||||||
'is_cof' : opegroup.is_cof,
|
'is_cof' : opegroup.is_cof,
|
||||||
'comment' : opegroup.comment,
|
'comment' : opegroup.comment,
|
||||||
'opes' : [],
|
'trigramme':
|
||||||
'on_acc__trigramme':
|
|
||||||
opegroup.on_acc and opegroup.on_acc.trigramme or None,
|
opegroup.on_acc and opegroup.on_acc.trigramme or None,
|
||||||
|
'day': {'id': opegroup.at.strftime('%Y%m%d'),
|
||||||
|
'date': opegroup.at},
|
||||||
}
|
}
|
||||||
if request.user.has_perm('kfet.is_team'):
|
if request.user.has_perm('kfet.is_team'):
|
||||||
opegroup_dict['valid_by__trigramme'] = (
|
opegroup_dict['valid_by'] = (
|
||||||
opegroup.valid_by and opegroup.valid_by.trigramme or None)
|
opegroup.valid_by and opegroup.valid_by.trigramme or None)
|
||||||
for ope in opegroup.opes.all():
|
for ope in opegroup.opes.all():
|
||||||
ope_dict = {
|
ope_dict = {
|
||||||
|
@ -1326,17 +1326,17 @@ def history_json(request):
|
||||||
'is_checkout' : ope.is_checkout,
|
'is_checkout' : ope.is_checkout,
|
||||||
'addcost_amount': ope.addcost_amount,
|
'addcost_amount': ope.addcost_amount,
|
||||||
'canceled_at' : ope.canceled_at,
|
'canceled_at' : ope.canceled_at,
|
||||||
'article__name':
|
'article_name':
|
||||||
ope.article and ope.article.name or None,
|
ope.article and ope.article.name or None,
|
||||||
'addcost_for__trigramme':
|
'addcost_for':
|
||||||
ope.addcost_for and ope.addcost_for.trigramme or None,
|
ope.addcost_for and ope.addcost_for.trigramme or None,
|
||||||
|
'opegroup': opegroup_dict,
|
||||||
}
|
}
|
||||||
if request.user.has_perm('kfet.is_team'):
|
if request.user.has_perm('kfet.is_team'):
|
||||||
ope_dict['canceled_by__trigramme'] = (
|
ope_dict['canceled_by'] = (
|
||||||
ope.canceled_by and ope.canceled_by.trigramme or None)
|
ope.canceled_by and ope.canceled_by.trigramme or None)
|
||||||
opegroup_dict['opes'].append(ope_dict)
|
ope_list.append(ope_dict)
|
||||||
opegroups_list.append(opegroup_dict)
|
return JsonResponse(ope_list, safe=False)
|
||||||
return JsonResponse({ 'opegroups': opegroups_list })
|
|
||||||
|
|
||||||
|
|
||||||
@teamkfet_required
|
@teamkfet_required
|
||||||
|
|
Loading…
Reference in a new issue