Sélection par défaut de la caisse lorsqu'il n'y en a qu'une seule disponible
This commit is contained in:
parent
3d2583e2a0
commit
468098ae7b
2 changed files with 10 additions and 2 deletions
|
@ -1139,7 +1139,7 @@ $(document).ready(function() {
|
||||||
|
|
||||||
function hardReset(give_tri_focus=true) {
|
function hardReset(give_tri_focus=true) {
|
||||||
coolReset(give_tri_focus);
|
coolReset(give_tri_focus);
|
||||||
resetCheckout();
|
checkoutInput.trigger('change');
|
||||||
resetArticles();
|
resetArticles();
|
||||||
khistory.reset();
|
khistory.reset();
|
||||||
resetSettings();
|
resetSettings();
|
||||||
|
|
|
@ -796,7 +796,15 @@ def kpsul(request):
|
||||||
data = {}
|
data = {}
|
||||||
data['operationgroup_form'] = KPsulOperationGroupForm()
|
data['operationgroup_form'] = KPsulOperationGroupForm()
|
||||||
data['trigramme_form'] = KPsulAccountForm()
|
data['trigramme_form'] = KPsulAccountForm()
|
||||||
data['checkout_form'] = KPsulCheckoutForm()
|
initial = {}
|
||||||
|
try:
|
||||||
|
checkout = Checkout.objects.filter(
|
||||||
|
is_protected=False, valid_from__lte=timezone.now(),
|
||||||
|
valid_to__gte=timezone.now()).get()
|
||||||
|
initial['checkout'] = checkout
|
||||||
|
except Checkout.DoesNotExist, Checkout.MultipleObjectsReturned:
|
||||||
|
pass
|
||||||
|
data['checkout_form'] = KPsulCheckoutForm(initial=initial)
|
||||||
operation_formset = KPsulOperationFormSet(queryset=Operation.objects.none())
|
operation_formset = KPsulOperationFormSet(queryset=Operation.objects.none())
|
||||||
data['operation_formset'] = operation_formset
|
data['operation_formset'] = operation_formset
|
||||||
return render(request, 'kfet/kpsul.html', data)
|
return render(request, 'kfet/kpsul.html', data)
|
||||||
|
|
Loading…
Reference in a new issue