in operation add current
This commit is contained in:
1 parent
3b26ee3f93
commit
333f990170
2 files changed
+34
-10
No files matched your search
@@ -10,8 +10,8 @@
|
|||||||
<th>نام محصول</th>
|
<th>نام محصول</th>
|
||||||
<th>ورود</th>
|
<th>ورود</th>
|
||||||
<th>خروج</th>
|
<th>خروج</th>
|
||||||
<th>توضیحات</th>
|
<th>مانده در لحظه</th> <th>توضیحات</th>
|
||||||
<th>ناریخ</th>
|
<th>تاریخ</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tfoot>
|
<tfoot>
|
||||||
@@ -19,8 +19,8 @@
|
|||||||
<th>نام محصول</th>
|
<th>نام محصول</th>
|
||||||
<th>ورود</th>
|
<th>ورود</th>
|
||||||
<th>خروج</th>
|
<th>خروج</th>
|
||||||
<th>توضیحات</th>
|
<th>مانده در لحظه</th> <th>توضیحات</th>
|
||||||
<th>ناریخ</th>
|
<th>تاریخ</th>
|
||||||
</tr>
|
</tr>
|
||||||
</tfoot>
|
</tfoot>
|
||||||
<tbody>
|
<tbody>
|
||||||
@@ -29,6 +29,9 @@
|
|||||||
<td>{{ operation.Product.product_name }} </td>
|
<td>{{ operation.Product.product_name }} </td>
|
||||||
<td>{{ operation.s_in }}</td>
|
<td>{{ operation.s_in }}</td>
|
||||||
<td>{{ operation.s_out }}</td>
|
<td>{{ operation.s_out }}</td>
|
||||||
|
<td class="has-text-weight-bold {% if operation.current_stock_at_time < 0 %}has-text-danger{% else %}has-text-dark{% endif %}">
|
||||||
|
{{ operation.current_stock_at_time }}
|
||||||
|
</td>
|
||||||
<td>{{ operation.desc }}</td>
|
<td>{{ operation.desc }}</td>
|
||||||
<td>{{ operation.createdDT | toJalali }}</td>
|
<td>{{ operation.createdDT | toJalali }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|||||||
+27
-6
@@ -599,8 +599,13 @@ def store(request, s_id):
|
|||||||
def operations(request, s_id):
|
def operations(request, s_id):
|
||||||
page = request.GET.get('page', 1)
|
page = request.GET.get('page', 1)
|
||||||
productCategory = ProductCategory.objects.all()
|
productCategory = ProductCategory.objects.all()
|
||||||
storeO = StoreRoom.objects.get(id=s_id)
|
storeO = get_object_or_404(StoreRoom, id=s_id)
|
||||||
operationsList = ProductInStore.objects.filter(StoreRoom=storeO, year=1400).order_by('-createdDT')
|
|
||||||
|
# بهینهسازی کلیدی: استفاده از select_related برای جلوگیری از کندی و پر شدن RAM دیتابیس
|
||||||
|
operationsList = ProductInStore.objects.filter(
|
||||||
|
StoreRoom=storeO, year=1400
|
||||||
|
).select_related('Product').order_by('-createdDT')
|
||||||
|
|
||||||
paginator = Paginator(operationsList, 25)
|
paginator = Paginator(operationsList, 25)
|
||||||
try:
|
try:
|
||||||
data_list = paginator.page(page)
|
data_list = paginator.page(page)
|
||||||
@@ -609,16 +614,32 @@ def operations(request, s_id):
|
|||||||
except EmptyPage:
|
except EmptyPage:
|
||||||
data_list = paginator.page(paginator.num_pages)
|
data_list = paginator.page(paginator.num_pages)
|
||||||
|
|
||||||
data = {'storeO': storeO, 'operationsList': data_list, 's_id': s_id, 'productCategory': productCategory}
|
data = {
|
||||||
|
'storeO': storeO,
|
||||||
|
'operationsList': data_list,
|
||||||
|
's_id': s_id,
|
||||||
|
'productCategory': productCategory
|
||||||
|
}
|
||||||
return render(request, 'admin_panel/operations.html', data)
|
return render(request, 'admin_panel/operations.html', data)
|
||||||
|
|
||||||
|
|
||||||
@login_required(login_url='/panel/p_login/')
|
@login_required(login_url='/panel/p_login/')
|
||||||
@permission_required('admin_panel.ViewStore', raise_exception=True)
|
@permission_required('admin_panel.ViewStore', raise_exception=True)
|
||||||
def operationProduct(request, s_id, p_id):
|
def operationProduct(request, s_id, p_id):
|
||||||
productCategory = ProductCategory.objects.all()
|
productCategory = ProductCategory.objects.all()
|
||||||
storeO = StoreRoom.objects.get(id=s_id)
|
storeO = get_object_or_404(StoreRoom, id=s_id)
|
||||||
operationsList = ProductInStore.objects.filter(StoreRoom=storeO, year=1400, Product__id=p_id).order_by('-createdDT')
|
|
||||||
data = {'storeO': storeO, 'operationsList': operationsList, 's_id': s_id, 'productCategory': productCategory}
|
# بهینهسازی کلیدی در فیلتر اختصاصی محصول
|
||||||
|
operationsList = ProductInStore.objects.filter(
|
||||||
|
StoreRoom=storeO, year=1400, Product__id=p_id
|
||||||
|
).select_related('Product').order_by('-createdDT')
|
||||||
|
|
||||||
|
data = {
|
||||||
|
'storeO': storeO,
|
||||||
|
'operationsList': operationsList,
|
||||||
|
's_id': s_id,
|
||||||
|
'productCategory': productCategory
|
||||||
|
}
|
||||||
return render(request, 'admin_panel/operations.html', data)
|
return render(request, 'admin_panel/operations.html', data)
|
||||||
|
|
||||||
@login_required(login_url='/panel/p_login/')
|
@login_required(login_url='/panel/p_login/')
|
||||||
|
|||||||
Reference in new issue
Block a user