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
45a126c9
Commit
45a126c9
authored
Jul 29, 2021
by
Damien Moulard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update product ref
parent
1533010a
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
46 additions
and
3 deletions
+46
-3
oders_helper_style.css
orders/static/css/oders_helper_style.css
+11
-2
orders_helper.js
orders/static/js/orders_helper.js
+0
-0
models.py
products/models.py
+23
-1
urls.py
products/urls.py
+1
-0
views.py
products/views.py
+11
-0
No files found.
orders/static/css/oders_helper_style.css
View file @
45a126c9
...
...
@@ -227,18 +227,27 @@
width
:
100px
;
}
.product_ref_input
{
padding
:
.5rem
.5rem
;
}
.supplier_package_qty
{
font-style
:
italic
;
font-size
:
1.3rem
;
}
.product_not_from_supplier
{
background-color
:
#e
7e9ed
;
background-color
:
#e
8ebf0
;
cursor
:
pointer
;
}
.product_not_from_supplier
:hover
{
background-color
:
#c7cace
;
background-color
:
#d3d7db
;
}
.product_ref_cell
:hover
{
background-color
:
#d3d7db
;
cursor
:
pointer
;
}
.product_name
,
.supplier_name
,
.product_npa
{
...
...
orders/static/js/orders_helper.js
View file @
45a126c9
This diff is collapsed.
Click to expand it.
products/models.py
View file @
45a126c9
...
...
@@ -130,6 +130,7 @@ class CagetteProduct(models.Model):
@staticmethod
def
associate_supplier_to_product
(
data
):
api
=
OdooAPI
()
res
=
{}
product_tmpl_id
=
data
[
"product_tmpl_id"
]
partner_id
=
data
[
"supplier_id"
]
...
...
@@ -151,7 +152,11 @@ class CagetteProduct(models.Model):
'package_qty'
:
package_qty
,
'sequence'
:
1000
# lowest priority for the new suppliers
}
res
=
api
.
create
(
'product.supplierinfo'
,
f
)
try
:
res
=
api
.
create
(
'product.supplierinfo'
,
f
)
except
Exception
as
e
:
res
[
'error'
]
=
str
(
e
)
return
res
...
...
@@ -188,6 +193,23 @@ class CagetteProduct(models.Model):
return
res
@staticmethod
def
update_product_internal_ref
(
product_tmpl_id
,
default_code
):
api
=
OdooAPI
()
res
=
{}
f
=
{
'default_code'
:
default_code
}
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
):
"""Initially used to make massive barcode update."""
...
...
products/urls.py
View file @
45a126c9
...
...
@@ -10,6 +10,7 @@ urlpatterns = [
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
),
url
(
r'^update_product_internal_ref$'
,
views
.
update_product_internal_ref
),
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'^shelf_labels$'
,
views
.
shelf_labels
),
# massive print
...
...
products/views.py
View file @
45a126c9
...
...
@@ -114,6 +114,17 @@ def update_product_purchase_ok(request):
else
:
return
JsonResponse
({
"res"
:
res
})
def
update_product_internal_ref
(
request
):
res
=
{}
data
=
json
.
loads
(
request
.
body
.
decode
())
res
=
CagetteProduct
.
update_product_internal_ref
(
data
[
"product_tmpl_id"
],
data
[
"default_code"
])
if
(
'error'
in
res
):
return
JsonResponse
(
res
,
status
=
500
)
else
:
return
JsonResponse
({
"res"
:
res
})
def
labels_appli_csv
(
request
,
params
):
"""Generate files to put in DAV directory to be retrieved by scales app."""
withCandidate
=
False
...
...
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