forked from DGNum/gestioCOF
Better scale management for order creation
+ Extends labels formatting of scale.
This commit is contained in:
parent
c11c3f84ed
commit
c0b8430a12
|
@ -86,7 +86,10 @@ class Scale(object):
|
||||||
def get_labels(self, label_fmt=None):
|
def get_labels(self, label_fmt=None):
|
||||||
if label_fmt is None:
|
if label_fmt is None:
|
||||||
label_fmt = self.label_fmt
|
label_fmt = self.label_fmt
|
||||||
return [begin.strftime(label_fmt) for begin, end in self]
|
return [
|
||||||
|
begin.strftime(label_fmt.format(i=i, rev_i=len(self)-i))
|
||||||
|
for i, (begin, end) in enumerate(self)
|
||||||
|
]
|
||||||
|
|
||||||
def chunkify_qs(self, qs, field=None):
|
def chunkify_qs(self, qs, field=None):
|
||||||
if field is None:
|
if field is None:
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
{% load kfet_tags %}
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-sm-12 col-md-8 col-md-offset-2 nopadding">
|
<div class="col-sm-12 col-md-8 col-md-offset-2 nopadding">
|
||||||
{% include "kfet/base_messages.html" %}
|
{% include "kfet/base_messages.html" %}
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
{% include 'kfet/base_messages.html' %}
|
{% include 'kfet/base_messages.html' %}
|
||||||
<div class="content-center">
|
<div class="content-center">
|
||||||
<form id='inventoryform' action="" method="post">
|
<form id='inventoryform' action="" method="post">
|
||||||
<div class="table-responsive">
|
<div class="table-responsive">
|
||||||
<table class="table table-condensed text-center">
|
<table class="table table-condensed text-center">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
|
@ -77,7 +77,7 @@
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
{{ formset.management_form }}
|
{{ formset.management_form }}
|
||||||
{% if not perms.kfet.add_inventory %}
|
{% if not perms.kfet.add_inventory %}
|
||||||
<div class='auth-form form-horizontal'>
|
<div class='auth-form form-horizontal'>
|
||||||
|
|
|
@ -36,11 +36,9 @@
|
||||||
<td rowspan="2">Commande</td>
|
<td rowspan="2">Commande</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>S1</td>
|
{% for label in scale.get_labels %}
|
||||||
<td>S2</td>
|
<td>{{ label }}</td>
|
||||||
<td>S3</td>
|
{% endfor %}
|
||||||
<td>S4</td>
|
|
||||||
<td>S5</td>
|
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
|
|
|
@ -1910,9 +1910,12 @@ def order_create(request, pk):
|
||||||
else:
|
else:
|
||||||
formset = cls_formset(initial=initial)
|
formset = cls_formset(initial=initial)
|
||||||
|
|
||||||
|
scale.label_fmt = "S-{rev_i}"
|
||||||
|
|
||||||
return render(request, 'kfet/order_create.html', {
|
return render(request, 'kfet/order_create.html', {
|
||||||
'supplier': supplier,
|
'supplier': supplier,
|
||||||
'formset': formset,
|
'formset': formset,
|
||||||
|
'scale': scale,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue