Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
third-party
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
cooperatic-foodcoops
third-party
Commits
70860307
Commit
70860307
authored
Mar 18, 2025
by
Yvon Kerdoncuff
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
entirely rework inventaire par produits app
parent
abe34fb6
Pipeline
#4183
failed with stage
Changes
6
Pipelines
1
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
12 additions
and
33 deletions
+12
-33
models.py
products/models.py
+4
-5
products.css
products/static/css/products.css
+5
-9
products_index.js
products/static/js/products_index.js
+0
-0
urls.py
products/urls.py
+1
-1
views.py
products/views.py
+2
-13
index.html
templates/products/index.html
+0
-5
No files found.
products/models.py
View file @
70860307
...
...
@@ -397,12 +397,11 @@ class CagetteProducts(models.Model):
return
api
.
search_read
(
'product.product'
,
cond
,
fields
)
@staticmethod
def
get_a
ctive_products_from_name
(
name
):
def
get_a
ll_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
=
[]):
...
...
products/static/css/products.css
View file @
70860307
.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
products/static/js/products_index.js
View file @
70860307
This diff is collapsed.
Click to expand it.
products/urls.py
View file @
70860307
...
...
@@ -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
),
...
...
products/views.py
View file @
70860307
...
...
@@ -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
:
...
...
templates/products/index.html
View file @
70860307
...
...
@@ -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>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment