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
0
Merge Requests
0
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
Alexis AOUN
third-party
Commits
43d8ccfd
Commit
43d8ccfd
authored
Jun 25, 2021
by
Damien Moulard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
set product npa
parent
e84f47f2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
47 additions
and
3 deletions
+47
-3
oders_helper_style.css
orders/static/css/oders_helper_style.css
+7
-2
orders_helper.js
orders/static/js/orders_helper.js
+0
-0
models.py
products/models.py
+19
-1
urls.py
products/urls.py
+1
-0
views.py
products/views.py
+10
-0
helper.html
templates/orders/helper.html
+10
-0
No files found.
orders/static/css/oders_helper_style.css
View file @
43d8ccfd
...
@@ -99,6 +99,11 @@
...
@@ -99,6 +99,11 @@
flex-wrap
:
wrap
;
flex-wrap
:
wrap
;
}
}
.select_all_text
{
margin-top
:
5px
;
margin-bottom
:
5px
;
}
#table_header_select_all
input
{
#table_header_select_all
input
{
margin-left
:
5px
;
margin-left
:
5px
;
}
}
...
@@ -112,11 +117,11 @@
...
@@ -112,11 +117,11 @@
cursor
:
pointer
;
cursor
:
pointer
;
}
}
.product_name
,
.supplier_name
{
.product_name
,
.supplier_name
,
.product_npa
{
font-weight
:
bold
;
font-weight
:
bold
;
}
}
.select_product_cb
{
.select_product_cb
,
.product_npa_cb
{
cursor
:
pointer
;
cursor
:
pointer
;
}
}
...
...
orders/static/js/orders_helper.js
View file @
43d8ccfd
This diff is collapsed.
Click to expand it.
products/models.py
View file @
43d8ccfd
...
@@ -148,6 +148,23 @@ class CagetteProduct(models.Model):
...
@@ -148,6 +148,23 @@ class CagetteProduct(models.Model):
return
res
return
res
@staticmethod
def
update_product_purchase_ok
(
product_tmpl_id
,
purchase_ok
):
api
=
OdooAPI
()
res
=
{}
f
=
{
'purchase_ok'
:
purchase_ok
}
try
:
res
[
"update"
]
=
api
.
update
(
'product.template'
,
product_tmpl_id
,
f
)
except
Exception
as
e
:
res
[
"error"
]
=
str
(
e
)
print
(
str
(
e
))
return
res
class
CagetteProducts
(
models
.
Model
):
class
CagetteProducts
(
models
.
Model
):
"""Initially used to make massive barcode update."""
"""Initially used to make massive barcode update."""
...
@@ -432,7 +449,8 @@ class CagetteProducts(models.Model):
...
@@ -432,7 +449,8 @@ class CagetteProducts(models.Model):
ptids
.
append
(
p
[
"product_tmpl_id"
][
0
])
ptids
.
append
(
p
[
"product_tmpl_id"
][
0
])
# Get products templates
# Get products templates
f
=
[
"id"
,
"state"
,
"name"
,
"default_code"
,
"qty_available"
,
"incoming_qty"
,
"uom_id"
]
f
=
[
"id"
,
"state"
,
"name"
,
"default_code"
,
"qty_available"
,
"incoming_qty"
,
"uom_id"
,
"purchase_ok"
]
# TODO fetch only 'purchase_ok' products ?
c
=
[[
'id'
,
'in'
,
ptids
],
[
'purchase_ok'
,
'='
,
True
]]
c
=
[[
'id'
,
'in'
,
ptids
],
[
'purchase_ok'
,
'='
,
True
]]
products_t
=
api
.
search_read
(
'product.template'
,
c
,
f
)
products_t
=
api
.
search_read
(
'product.template'
,
c
,
f
)
filtered_products_t
=
[
p
for
p
in
products_t
if
p
[
"state"
]
!=
"end"
and
p
[
"state"
]
!=
"obsolete"
]
filtered_products_t
=
[
p
for
p
in
products_t
if
p
[
"state"
]
!=
"end"
and
p
[
"state"
]
!=
"obsolete"
]
...
...
products/urls.py
View file @
43d8ccfd
...
@@ -7,6 +7,7 @@ urlpatterns = [
...
@@ -7,6 +7,7 @@ urlpatterns = [
url
(
r'^get_product_data$'
,
views
.
get_product_data
),
url
(
r'^get_product_data$'
,
views
.
get_product_data
),
url
(
r'^get_products_stdprices$'
,
views
.
get_products_stdprices
),
url
(
r'^get_products_stdprices$'
,
views
.
get_products_stdprices
),
url
(
r'^update_product_stock$'
,
views
.
update_product_stock
),
url
(
r'^update_product_stock$'
,
views
.
update_product_stock
),
url
(
r'^update_product_purchase_ok$'
,
views
.
update_product_purchase_ok
),
url
(
r'^labels_appli_csv(\/?[a-z]*)$'
,
views
.
labels_appli_csv
,
name
=
'labels_appli_csv'
),
url
(
r'^labels_appli_csv(\/?[a-z]*)$'
,
views
.
labels_appli_csv
,
name
=
'labels_appli_csv'
),
url
(
r'^label_print/([0-9]+)/?([0-9\.]*)/?([a-z]*)/?([0-9]*)$'
,
views
.
label_print
),
url
(
r'^label_print/([0-9]+)/?([0-9\.]*)/?([a-z]*)/?([0-9]*)$'
,
views
.
label_print
),
url
(
r'^shelf_labels$'
,
views
.
shelf_labels
),
# massive print
url
(
r'^shelf_labels$'
,
views
.
shelf_labels
),
# massive print
...
...
products/views.py
View file @
43d8ccfd
...
@@ -75,6 +75,16 @@ def update_product_stock(request):
...
@@ -75,6 +75,16 @@ def update_product_stock(request):
return
JsonResponse
({
"res"
:
res
})
return
JsonResponse
({
"res"
:
res
})
def
update_product_purchase_ok
(
request
):
res
=
{}
data
=
json
.
loads
(
request
.
body
.
decode
())
res
=
CagetteProduct
.
update_product_purchase_ok
(
data
[
"product_tmpl_id"
],
data
[
"purchase_ok"
])
if
(
'error'
in
res
):
return
JsonResponse
(
res
,
status
=
500
)
else
:
return
JsonResponse
({
"res"
:
res
})
def
labels_appli_csv
(
request
,
params
):
def
labels_appli_csv
(
request
,
params
):
"""Generate files to put in DAV directory to be retrieved by scales app."""
"""Generate files to put in DAV directory to be retrieved by scales app."""
...
...
templates/orders/helper.html
View file @
43d8ccfd
...
@@ -116,6 +116,16 @@
...
@@ -116,6 +116,16 @@
<p>
Êtez-vous sûr ?
</p>
<p>
Êtez-vous sûr ?
</p>
<hr/>
<hr/>
</div>
</div>
<div
id=
"modal_product_npa"
>
<h3>
Attention !
</h3>
<p>
Vous vous apprêtez à passer le produit
<span
class=
"product_name"
></span>
en
<span
class=
"product_npa"
></span>
.
<br/>
L'information sera enregistrée dès que vous aurez cliqué sur "Valider".
</p>
<p>
Êtez-vous sûr ?
</p>
<hr/>
</div>
</div>
</div>
</div>
</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