Commit 2d478df2 by Arnaud B

Affichage de la colonne Autres seulement pour La Cagette

parent 08e17076
Pipeline #1033 passed with stage
in 25 seconds
...@@ -126,6 +126,7 @@ function fetch_data() { ...@@ -126,6 +126,7 @@ function fetch_data() {
contentType: "application/json; charset=utf-8", contentType: "application/json; charset=utf-8",
data: JSON.stringify({'po_ids' : group_ids}), data: JSON.stringify({'po_ids' : group_ids}),
success: function(data) { success: function(data) {
console.log(data);
// for each order // for each order
for (order_data of data.orders) { for (order_data of data.orders) {
// for each product in order // for each product in order
...@@ -270,6 +271,14 @@ function initLists() { ...@@ -270,6 +271,14 @@ function initLists() {
defaultContent: "<a class='btn' id='toProcess_line_valid' href='#'><i class='far fa-check-square'></i></a>", defaultContent: "<a class='btn' id='toProcess_line_valid' href='#'><i class='far fa-check-square'></i></a>",
className:"dt-body-center", className:"dt-body-center",
orderable: false orderable: false
},
{
title:"Autres",
defaultContent: "<select class='select_product_action'><option value=''></option><option value='supplier_shortage'>Rupture fournisseur</option></select>",
className:"dt-body-center",
orderable: false,
visible: display_autres
} }
], ],
rowId : "product_id.0", rowId : "product_id.0",
...@@ -335,6 +344,21 @@ function initLists() { ...@@ -335,6 +344,21 @@ function initLists() {
defaultContent: "<a class='btn' id='processed_line_edit' href='#'><i class='far fa-edit'></i></a>", defaultContent: "<a class='btn' id='processed_line_edit' href='#'><i class='far fa-edit'></i></a>",
className:"dt-body-center", className:"dt-body-center",
orderable: false orderable: false
},
{
title: "Autres",
className: "dt-body-center",
orderable: false,
render: function (data, type, full) {
//console.log(full);
let disabled = (full.supplier_shortage) ? "disabled" : '';
return "<select class='select_product_action'>"
+ "<option value=''></option>"
+ "<option value='supplier_shortage' " + disabled + ">Rupture fournisseur</option>"
+ "</select>";
},
visible: display_autres
} }
], ],
rowId : "product_id.0", rowId : "product_id.0",
......
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
from outils.common_imports import * from outils.common_imports import *
from outils.for_view_imports import * from outils.for_view_imports import *
from django.views.generic import View from django.views.generic import View
import os import os
from datetime import date from datetime import date
from openpyxl import Workbook from openpyxl import Workbook
...@@ -14,7 +13,6 @@ from outils.common import OdooAPI ...@@ -14,7 +13,6 @@ from outils.common import OdooAPI
from members.models import CagetteUser from members.models import CagetteUser
from products.models import CagetteProduct from products.models import CagetteProduct
def as_text(value): def as_text(value):
""" Utils """ """ Utils """
return str(value) if value is not None else "" return str(value) if value is not None else ""
...@@ -71,9 +69,12 @@ def get_list_orders(request): ...@@ -71,9 +69,12 @@ def get_list_orders(request):
def produits(request, id): def produits(request, id):
""" Gets Order details """ """ Gets Order details """
context = {'title': 'Réception des produits', context = {'title': 'Réception des produits',
"TOOLS_SERVER": settings.TOOLS_SERVER} "TOOLS_SERVER": settings.TOOLS_SERVER,
"DISPLAY_AUTRES": "false" if (settings.COMPANY_NAME == "La Cagette") else "true",
}
fixed_barcode_prefix = '0490' fixed_barcode_prefix = '0490'
if hasattr(settings, 'RECEPTION_PB_EMAIL'): if hasattr(settings, 'RECEPTION_PB_EMAIL'):
context['RECEPTION_PB_EMAIL'] = settings.RECEPTION_PB_EMAIL context['RECEPTION_PB_EMAIL'] = settings.RECEPTION_PB_EMAIL
else: else:
...@@ -97,7 +98,6 @@ def produits(request, id): ...@@ -97,7 +98,6 @@ def produits(request, id):
def get_order_lines(request, id_po): def get_order_lines(request, id_po):
"""Send content of an order""" """Send content of an order"""
order_lines = CagetteReception.get_order_lines_by_po(int(id_po)) order_lines = CagetteReception.get_order_lines_by_po(int(id_po))
return JsonResponse({'id_po': id_po, 'po': order_lines}) return JsonResponse({'id_po': id_po, 'po': order_lines})
def get_orders_lines(request): def get_orders_lines(request):
......
...@@ -185,6 +185,7 @@ ...@@ -185,6 +185,7 @@
<script type="text/javascript"> <script type="text/javascript">
var tools_server = '{{TOOLS_SERVER}}' var tools_server = '{{TOOLS_SERVER}}'
var fixed_barcode_prefix = '{{FIXED_BARCODE_PREFIX}}' var fixed_barcode_prefix = '{{FIXED_BARCODE_PREFIX}}'
var display_autres = {{DISPLAY_AUTRES}};
</script> </script>
<script src="{% static "js/all_common.js" %}?v="></script> <script src="{% static "js/all_common.js" %}?v="></script>
<script src='{% static "js/barcodes.js" %}?v='></script> <script src='{% static "js/barcodes.js" %}?v='></script>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment