Commit f962b763 by François C.

Merge branch '2936-reception-add-products' into 'dev_cooperatic'

2936 reception add products

See merge request !185
parents 5916f6b2 3b618502
Pipeline #2270 passed with stage
in 1 minute 27 seconds
......@@ -55,6 +55,7 @@ EM_URL = ''
RECEPTION_MERGE_ORDERS_PSWD = 'jpsrcp'
RECEPTION_ADD_PRODUCTS_PSWD = 'jpsrcp'
RECEPTION_PB = "Ici, vous pouvez signaler toute anomalie lors d'une réception, les produits non commandés, cassés ou pourris. \
Merci d'indiquer un maximum d'informations, le nom du produit et son code barre."
DISPLAY_COL_AUTRES = False
......
......@@ -352,6 +352,11 @@
Password to enter to validate merge orders processing
It has been set only to stop member action, considering the impact of the merge
- RECEPTION_ADD_PRODUCTS_PSWD = 'pass2makeApause'
Password to enter to add products to an order during reception
Same principle as previous pswd
- RECEPTION_PDT_LABELS_BTN_TEXT = 'Lancer l\'impression'
- RECEPTION_PDT_LABELS_FN = 'print_product_labels()'
......
......@@ -17,18 +17,22 @@ class CagetteReception(models.Model):
self.id = int(id)
self.o_api = OdooAPI()
def get_orders():
"""Recupere la liste des BC en cours """
def get_orders(pids=[]):
"""
Recupere la liste des BC en cours.
pids: Id des purchase.order à récupérer. Limite la recherche si défini.
"""
orders = []
try:
api = OdooAPI()
f = ["purchase_id"]
c = [['picking_type_id', '=', 1], ["state", "in", ['assigned', 'partially_available']]]
res = api.search_read('stock.picking', c, f)
pids = []
if res and len(res) > 0:
for r in res:
pids.append(int(r['purchase_id'][0]))
if len(pids) == 0:
f = ["purchase_id"]
c = [['picking_type_id', '=', 1], ["state", "in", ['assigned', 'partially_available']]]
res = api.search_read('stock.picking', c, f)
pids = []
if res and len(res) > 0:
for r in res:
pids.append(int(r['purchase_id'][0]))
if len(pids):
f=["id","name","date_order", "partner_id", "date_planned", "amount_untaxed", "amount_total", "x_reception_status", 'create_uid']
......
......@@ -205,6 +205,76 @@ tr.odd td.row_product_no_qty {
background-color: rgb(236, 182, 106); /*#ec971f*/
}
.add_products_button_container {
display: flex;
justify-content: center;
align-items: center;
}
#add_products_button {
display: none;
}
.search_products_to_add_area {
margin: 2rem 0;
display: flex;
align-items: center;
justify-content: center;
}
.search_product_input {
width: 60%;
}
.autocomplete_dropdown {
z-index: 10000001 !important;
}
.search_product_help {
margin-left: 10px;
}
.products_lines {
display: none;
}
.products_lines_title {
margin: 3rem 0 2rem 0;
}
.add_product_line {
display: flex;
align-items: center;
margin: 1rem 0;
}
.add_product_line_item {
width: 45%;
display: flex;
flex-direction: column;
align-items: center;
}
.product_qty_input_alert {
color: #d9534f;
font-size: 1.4rem;
display: none;
}
.remove_line {
width: 10%;
color: #d9534f;
cursor: pointer;
}
.remove_line:hover {
color: #c9302c;
}
.product_already_selected,
.product_already_selected:hover {
background-color: #acb3c2;
}
/* Accordion style */
/* Style the buttons that are used to open and close the accordion panel */
......
......@@ -43,7 +43,11 @@ def home(request):
def get_list_orders(request):
ordersOdoo = CagetteReception.get_orders()
poids = [int(i) for i in request.GET.getlist('poids', [])]
get_order_lines = request.GET.get('get_order_lines', False)
get_order_lines = get_order_lines == "true"
ordersOdoo = CagetteReception.get_orders(poids)
orders = []
for order in ordersOdoo:
# Order with date at 'False' was found.
......@@ -60,12 +64,18 @@ def get_list_orders(request):
"id" : order["id"],
"name" : order["name"],
"date_order" : order["date_order"],
"partner_id" : order["partner_id"][0],
"partner" : order["partner_id"][1],
"date_planned" : order["date_planned"],
"amount_untaxed" : round(order["amount_untaxed"],2),
"amount_total" : round(order["amount_total"],2),
"reception_status" : str(order["x_reception_status"])
}
if get_order_lines is True:
order_lines = CagetteReception.get_order_lines_by_po(int(order["id"]), nullQty = True)
ligne["po"] = order_lines
orders.append(ligne)
return JsonResponse({"data": orders}, safe=False)
......@@ -82,6 +92,7 @@ def produits(request, id):
"DISPLAY_AUTRES": getattr(settings, 'DISPLAY_COL_AUTRES', True),
"ADD_ALL_LEFT_IS_GOOD_QTIES": False,
"ADD_ALL_LEFT_IS_GOOD_PRICES": False,
'add_products_pswd': getattr(settings, 'RECEPTION_ADD_PRODUCTS_PSWD', 'makeastop'),
}
fixed_barcode_prefix = '0490'
......
......@@ -4,6 +4,7 @@
{% block additionnal_css %}
<link rel="stylesheet" href="{% static 'css/datatables/jquery.dataTables.css' %}">
<link rel="stylesheet" href="{% static 'css/reception_style.css' %}">
<link rel="stylesheet" href="{% static 'jquery-ui-1.12.1/jquery-ui.min.css' %}">
{% endblock %}
{% block additionnal_scripts %}
......@@ -11,6 +12,7 @@
<script type="text/javascript" src="{% static 'js/datatables/jquery.dataTables.min.js' %}"></script>
<script type="text/javascript" src="{% static 'js/datatables/dataTables.plugins.js' %}"></script>
<script type="text/javascript" src="{% static 'js/jquery.pos.js' %}"></script>
<script type="text/javascript" src="{% static 'jquery-ui-1.12.1/jquery-ui.min.js' %}?v=1651853225"></script>
{% endblock %}
{% block content %}
......@@ -103,7 +105,7 @@
</div>
</div>
<div class="row-2 container_products" id="container_left">
<div class="container_products" id="container_left">
<h4 id="header_container_left"></h4>
<table id="table_to_process" class="display" cellspacing="0" ></table>
</div>
......@@ -111,6 +113,9 @@
<h4 id="header_container_right"></h4>
<table id="table_processed" class="display" cellspacing="0" ></table>
</div>
<div class="txtcenter add_products_button_container">
<button id="add_products_button" class="btn--inverse full_width_button">Ajouter des produits</button>
</div>
<div class="txtcenter">
<span id="validation_button"></span>
</div>
......@@ -185,6 +190,36 @@
est bien <b><span id="price_to_verify"></span></b> euros/Kg ?</p>
<input type="number" name="Prix au Kilo" id="new_price_to_weight">
</div>
<div id="modal_add_products">
<h3>Ajouter des produits à la commande</h3>
<div class="search_products_to_add_area">
<input type="text" class="search_product_input" name="search_product_input" placeholder="Rechercher un produit...">
<i
class='fa fa-info-circle search_product_help'
title='Vous ne trouvez pas un produit ? Les produits déjà dans la commande ou déjà sélectionnés ont été retirés de la liste.'
>
</i>
</div>
<div class="products_lines">
<p class="products_lines_title">
Liste des produits qui seront ajoutés à la commande.
<b>Vous devez renseigner une quantité pour chaque produit.</b>
</p>
</div>
<hr />
</div>
<div id="add_product_line_template">
<div class="add_product_line">
<div class="product_name add_product_line_item"></div>
<div class="product_qty add_product_line_item">
<input type="number" autocomplete="off" class="product_qty_input input_small" placeholder="Quantité">
<i class="product_qty_input_alert">Vous devez renseigner une quantité</i>
</div>
<div class="remove_line">
<i class="fas fa-times fa-lg remove_line_icon"></i>
</div>
</div>
</div>
</div>
<br/>
</div>
......@@ -198,6 +233,7 @@
var display_autres = "{{DISPLAY_AUTRES}}";
var add_all_left_is_good_qties = "{{ADD_ALL_LEFT_IS_GOOD_QTIES}}"
var add_all_left_is_good_prices = "{{ADD_ALL_LEFT_IS_GOOD_PRICES}}"
var add_products_pswd = "{{add_products_pswd}}"
</script>
<script src="{% static "js/all_common.js" %}?v=1651853225"></script>
<script src='{% static "js/barcodes.js" %}?v=1651853225'></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