Commit 70860307 by Yvon Kerdoncuff

entirely rework inventaire par produits app

parent abe34fb6
Pipeline #4183 failed with stage
......@@ -397,12 +397,11 @@ class CagetteProducts(models.Model):
return api.search_read('product.product', cond, fields)
@staticmethod
def get_active_products_from_name(name):
def get_all_active_products():
api = OdooAPI()
cond = [['active', '=', True],
['name', 'ilike', name]]
fields = ['id', 'uom_id', 'name', 'qty_available', 'barcode', 'active', 'shelf_id', 'product_tmpl_id']
return api.search_read('product.product', cond, fields)
cond = [['active', '=', True]]
fields = ['id', 'uom_id', 'name', 'qty_available', 'barcode']
return api.search_read('product.product', cond, fields, limit=False)
@staticmethod
def get_vrac_products_from_cats(cats, withCandidate=False, fields=[]):
......
.main, .barcode_or_name_search_area {
margin-top: 20px;
}
#barcode_or_name_selector {
border: 1px solid #555;
border-radius:15px;
}
.stock_edit_input {
max-width: 100px;
}
.dataTables_filter {
display: block !important; /* S'assure qu'elle est bien affichée */
}
\ No newline at end of file
......@@ -7,7 +7,7 @@ urlpatterns = [
url(r'^simple_list$', views.get_simple_list),
url(r'^get_product_for_order_helper$', views.get_product_for_order_helper),
url(r'^get_product_data$', views.get_product_data),
url(r'^get_products_data_by_barcode_or_name$', views.get_products_data_by_barcode_or_name),
url(r'^get_all_active_products$', views.get_all_active_products),
url(r'^get_products_stdprices$', views.get_products_stdprices),
url(r'^update_product_stock$', views.update_product_stock),
url(r'^update_product_purchase_ok$', views.update_product_purchase_ok),
......
......@@ -55,19 +55,8 @@ def get_product_for_order_helper(request):
else:
return JsonResponse(res, safe=False)
def get_products_data_by_barcode_or_name(request):
input = request.GET['input']
# check if it is probably a barcode input
if input.isdigit() and len(input) > 6:
products = CagetteProduct.get_product_from_barcode(input)
# or a text input
else:
products = CagetteProducts.get_active_products_from_name(input)
#commented because too slow
#for product in products:
# add_shelf_sortorder(product)
def get_all_active_products(request):
products = CagetteProducts.get_all_active_products()
if not products:
return JsonResponse({"product": products}, status=404)
else:
......
......@@ -18,11 +18,6 @@
<h1>Inventaire par produits</h1>
</div>
<div class="barcode_or_name_search_area txtcenter">
<input type="text" id="barcode_or_name_selector" name="barcode_or_name_selector" placeholder="Nom ou codebarre">
<button type="button" class="btn--primary" id="button_barcode_or_name_selector" name="button">Recherche</button>
</div>
<div class="main">
<table id="products_table" class="display" cellspacing="0" ></table>
</div>
......
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