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
0d008517
Commit
0d008517
authored
Aug 16, 2022
by
François C.
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add stock values functionality in stock menu
parent
40743fbe
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
25 additions
and
2 deletions
+25
-2
models.py
stock/models.py
+11
-1
urls.py
stock/urls.py
+4
-0
views.py
stock/views.py
+9
-1
stock_menu.html
templates/stock/stock_menu.html
+1
-0
No files found.
stock/models.py
View file @
0d008517
...
...
@@ -365,7 +365,17 @@ class CagetteStock(models.Model):
return
res
@staticmethod
def
get_valuable_stock
():
articles
=
[]
try
:
api
=
OdooAPI
()
cond
=
[[
'qty_available'
,
'>'
,
0
],
[
'active'
,
'='
,
True
]]
fields
=
[
"barcode"
,
"display_name"
,
"qty_available"
,
"standard_price"
]
articles
=
api
.
search_read
(
'product.product'
,
cond
,
fields
,
1000000
)
except
Exception
as
e
:
coop_logger
.
error
(
"Erreur get_valuable_stock :
%
s"
,
str
(
e
))
return
articles
def
set_test
():
o_api
=
OdooAPI
()
...
...
stock/urls.py
View file @
0d008517
...
...
@@ -46,4 +46,8 @@ urlpatterns = [
url
(
r'^get_saleWitheNotSale'
,
views
.
get_saleWitheNotSale
),
url
(
r'^get_test'
,
views
.
get_test
),
# Values
url
(
r'^stockValues'
,
views
.
stockValues
),
url
(
r'^get_valuable_stock'
,
views
.
get_valuable_stock
),
]
stock/views.py
View file @
0d008517
...
...
@@ -550,8 +550,16 @@ def get_saleWitheNotSale(request):
return
JsonResponse
({
"data"
:
lArticleSale
},
safe
=
True
)
def
stockValues
(
request
):
"""Page valeurs du stock (quantités positives)."""
context
=
{
'title'
:
'Stock (quantités positives valorisées)'
}
template
=
loader
.
get_template
(
'stock/stock_values.html'
)
return
HttpResponse
(
template
.
render
(
context
,
request
))
def
get_valuable_stock
(
request
):
articles
=
CagetteStock
.
get_valuable_stock
()
return
JsonResponse
({
"data"
:
articles
},
safe
=
True
)
def
get_test
(
request
):
res
=
CagetteStock
.
get_sale_qty_by_from
(
1
)
return
JsonResponse
({
"data"
:
res
},
safe
=
False
)
templates/stock/stock_menu.html
View file @
0d008517
...
...
@@ -31,6 +31,7 @@
<a
class=
"dropdown-item"
href=
"breakingArticleSet"
>
Mettre en rupture un article sur odoo
</a>
<a
class=
"dropdown-item"
href=
"stockQuantLastSale"
>
Date de la dernière vente des articles
</a>
<a
class=
"dropdown-item"
href=
"saleWithNotSale"
>
Vente avec jours sans vente
</a>
<a
class=
"dropdown-item"
href=
"stockValues"
>
Stock (qtés > 0 valorisées)
</a>
</div>
</li>
</ul>
...
...
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