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 = '' ...@@ -55,6 +55,7 @@ EM_URL = ''
RECEPTION_MERGE_ORDERS_PSWD = 'jpsrcp' 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. \ 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." Merci d'indiquer un maximum d'informations, le nom du produit et son code barre."
DISPLAY_COL_AUTRES = False DISPLAY_COL_AUTRES = False
......
...@@ -352,6 +352,11 @@ ...@@ -352,6 +352,11 @@
Password to enter to validate merge orders processing Password to enter to validate merge orders processing
It has been set only to stop member action, considering the impact of the merge 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_BTN_TEXT = 'Lancer l\'impression'
- RECEPTION_PDT_LABELS_FN = 'print_product_labels()' - RECEPTION_PDT_LABELS_FN = 'print_product_labels()'
......
...@@ -17,18 +17,22 @@ class CagetteReception(models.Model): ...@@ -17,18 +17,22 @@ class CagetteReception(models.Model):
self.id = int(id) self.id = int(id)
self.o_api = OdooAPI() self.o_api = OdooAPI()
def get_orders(): def get_orders(pids=[]):
"""Recupere la liste des BC en cours """ """
Recupere la liste des BC en cours.
pids: Id des purchase.order à récupérer. Limite la recherche si défini.
"""
orders = [] orders = []
try: try:
api = OdooAPI() api = OdooAPI()
f = ["purchase_id"] if len(pids) == 0:
c = [['picking_type_id', '=', 1], ["state", "in", ['assigned', 'partially_available']]] f = ["purchase_id"]
res = api.search_read('stock.picking', c, f) c = [['picking_type_id', '=', 1], ["state", "in", ['assigned', 'partially_available']]]
pids = [] res = api.search_read('stock.picking', c, f)
if res and len(res) > 0: pids = []
for r in res: if res and len(res) > 0:
pids.append(int(r['purchase_id'][0])) for r in res:
pids.append(int(r['purchase_id'][0]))
if len(pids): if len(pids):
f=["id","name","date_order", "partner_id", "date_planned", "amount_untaxed", "amount_total", "x_reception_status", 'create_uid'] 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 { ...@@ -205,6 +205,76 @@ tr.odd td.row_product_no_qty {
background-color: rgb(236, 182, 106); /*#ec971f*/ 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 */ /* Accordion style */
/* Style the buttons that are used to open and close the accordion panel */ /* Style the buttons that are used to open and close the accordion panel */
......
...@@ -43,7 +43,11 @@ def home(request): ...@@ -43,7 +43,11 @@ def home(request):
def get_list_orders(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 = [] orders = []
for order in ordersOdoo: for order in ordersOdoo:
# Order with date at 'False' was found. # Order with date at 'False' was found.
...@@ -60,12 +64,18 @@ def get_list_orders(request): ...@@ -60,12 +64,18 @@ def get_list_orders(request):
"id" : order["id"], "id" : order["id"],
"name" : order["name"], "name" : order["name"],
"date_order" : order["date_order"], "date_order" : order["date_order"],
"partner_id" : order["partner_id"][0],
"partner" : order["partner_id"][1], "partner" : order["partner_id"][1],
"date_planned" : order["date_planned"], "date_planned" : order["date_planned"],
"amount_untaxed" : round(order["amount_untaxed"],2), "amount_untaxed" : round(order["amount_untaxed"],2),
"amount_total" : round(order["amount_total"],2), "amount_total" : round(order["amount_total"],2),
"reception_status" : str(order["x_reception_status"]) "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) orders.append(ligne)
return JsonResponse({"data": orders}, safe=False) return JsonResponse({"data": orders}, safe=False)
...@@ -82,6 +92,7 @@ def produits(request, id): ...@@ -82,6 +92,7 @@ def produits(request, id):
"DISPLAY_AUTRES": getattr(settings, 'DISPLAY_COL_AUTRES', True), "DISPLAY_AUTRES": getattr(settings, 'DISPLAY_COL_AUTRES', True),
"ADD_ALL_LEFT_IS_GOOD_QTIES": False, "ADD_ALL_LEFT_IS_GOOD_QTIES": False,
"ADD_ALL_LEFT_IS_GOOD_PRICES": False, "ADD_ALL_LEFT_IS_GOOD_PRICES": False,
'add_products_pswd': getattr(settings, 'RECEPTION_ADD_PRODUCTS_PSWD', 'makeastop'),
} }
fixed_barcode_prefix = '0490' fixed_barcode_prefix = '0490'
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
{% block additionnal_css %} {% block additionnal_css %}
<link rel="stylesheet" href="{% static 'css/datatables/jquery.dataTables.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 'css/reception_style.css' %}">
<link rel="stylesheet" href="{% static 'jquery-ui-1.12.1/jquery-ui.min.css' %}">
{% endblock %} {% endblock %}
{% block additionnal_scripts %} {% block additionnal_scripts %}
...@@ -11,6 +12,7 @@ ...@@ -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/jquery.dataTables.min.js' %}"></script>
<script type="text/javascript" src="{% static 'js/datatables/dataTables.plugins.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 'js/jquery.pos.js' %}"></script>
<script type="text/javascript" src="{% static 'jquery-ui-1.12.1/jquery-ui.min.js' %}?v=1651853225"></script>
{% endblock %} {% endblock %}
{% block content %} {% block content %}
...@@ -103,7 +105,7 @@ ...@@ -103,7 +105,7 @@
</div> </div>
</div> </div>
<div class="row-2 container_products" id="container_left"> <div class="container_products" id="container_left">
<h4 id="header_container_left"></h4> <h4 id="header_container_left"></h4>
<table id="table_to_process" class="display" cellspacing="0" ></table> <table id="table_to_process" class="display" cellspacing="0" ></table>
</div> </div>
...@@ -111,6 +113,9 @@ ...@@ -111,6 +113,9 @@
<h4 id="header_container_right"></h4> <h4 id="header_container_right"></h4>
<table id="table_processed" class="display" cellspacing="0" ></table> <table id="table_processed" class="display" cellspacing="0" ></table>
</div> </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"> <div class="txtcenter">
<span id="validation_button"></span> <span id="validation_button"></span>
</div> </div>
...@@ -185,6 +190,36 @@ ...@@ -185,6 +190,36 @@
est bien <b><span id="price_to_verify"></span></b> euros/Kg ?</p> 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"> <input type="number" name="Prix au Kilo" id="new_price_to_weight">
</div> </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> </div>
<br/> <br/>
</div> </div>
...@@ -198,6 +233,7 @@ ...@@ -198,6 +233,7 @@
var display_autres = "{{DISPLAY_AUTRES}}"; var display_autres = "{{DISPLAY_AUTRES}}";
var add_all_left_is_good_qties = "{{ADD_ALL_LEFT_IS_GOOD_QTIES}}" 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_all_left_is_good_prices = "{{ADD_ALL_LEFT_IS_GOOD_PRICES}}"
var add_products_pswd = "{{add_products_pswd}}"
</script> </script>
<script src="{% static "js/all_common.js" %}?v=1651853225"></script> <script src="{% static "js/all_common.js" %}?v=1651853225"></script>
<script src='{% static "js/barcodes.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