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
1d62cd4b
Commit
1d62cd4b
authored
Jul 07, 2023
by
François C.
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
uncommited stuff (should be only patches and methods for specific supercafoutch needs)
parent
38f3ee82
Pipeline
#2908
failed with stage
in 1 minute 4 seconds
Changes
6
Pipelines
3
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
44 additions
and
2 deletions
+44
-2
models.py
inventory/models.py
+29
-0
urls.py
inventory/urls.py
+1
-0
views.py
inventory/views.py
+11
-0
manage_regular_shifts.js
members/static/js/admin/manage_regular_shifts.js
+1
-1
reception_produits.js
reception/static/js/reception_produits.js
+1
-0
views.py
reception/views.py
+1
-1
No files found.
inventory/models.py
View file @
1d62cd4b
...
...
@@ -427,6 +427,35 @@ class CagetteInventory(models.Model):
'inv_id'
:
inv
}
@staticmethod
def
general_reset_stock
(
qty
=
0
):
missed
=
[]
done
=
[]
api
=
OdooAPI
()
# cond = [['active', '=', False], ['qty_available', '!=', 0]]
cond
=
[[
'active'
,
'='
,
True
],
[
'id'
,
'>'
,
5100
],
[
'id'
,
'<='
,
5400
]]
fields
=
[
'uom_id'
,
'name'
,
'qty_available'
]
res
=
api
.
search_read
(
'product.product'
,
cond
,
fields
,
1500
)
if
len
(
res
)
>
0
:
fields
=
{
'company_id'
:
1
,
'name'
:
'RAZ general reset'
,
'location_id'
:
settings
.
STOCK_LOC_ID
}
inv
=
api
.
create
(
'stock.inventory'
,
fields
)
if
not
(
inv
is
None
):
for
p
in
res
:
try
:
if
p
[
'qty_available'
]
!=
qty
and
p
[
'qty_available'
]
<
0
and
p
[
'qty_available'
]
>
-
30
:
fields
=
{
'product_id'
:
p
[
'id'
],
'inventory_id'
:
inv
,
'product_qty'
:
qty
,
'product_uom_id'
:
p
[
'uom_id'
][
0
],
'location_id'
:
settings
.
STOCK_LOC_ID
}
li
=
api
.
create
(
'stock.inventory.line'
,
fields
)
done
.
append
({
'product'
:
p
,
'id'
:
li
})
except
Exception
as
e
:
missed
.
append
({
'product'
:
p
,
'msg'
:
str
(
e
)})
api
.
execute
(
'stock.inventory'
,
'action_done'
,
[
inv
])
return
{
'missed'
:
missed
,
'done'
:
done
}
@staticmethod
def
raz_archived_stock
():
missed
=
[]
done
=
[]
...
...
inventory/urls.py
View file @
1d62cd4b
...
...
@@ -16,6 +16,7 @@ urlpatterns = [
url
(
r'^get_product_categories$'
,
views
.
get_product_categories
),
url
(
r'^create_inventory$'
,
views
.
create_inventory
),
url
(
r'^update_odoo_stock$'
,
views
.
update_odoo_stock
),
url
(
r'^general_reset_stock/?([0-9]*)$'
,
views
.
general_reset_stock
),
url
(
r'^raz_archived_stock$'
,
views
.
raz_archived_stock
),
url
(
r'^raz_negative_stock$'
,
views
.
raz_negative_stock
),
url
(
r'^raz_not_saleable$'
,
views
.
raz_not_saleable
),
...
...
inventory/views.py
View file @
1d62cd4b
...
...
@@ -168,6 +168,17 @@ def update_odoo_stock(request):
res
[
'msg'
]
=
'Forbidden'
return
JsonResponse
(
res
)
def
general_reset_stock
(
request
,
qty
):
res
=
{}
if
True
or
CagetteUser
.
are_credentials_ok
(
request
):
try
:
res
[
'action'
]
=
CagetteInventory
.
general_reset_stock
(
qty
)
except
Exception
as
e
:
res
[
'msg'
]
=
str
(
e
)
else
:
res
[
'msg'
]
=
'Forbidden'
return
JsonResponse
(
res
)
def
raz_archived_stock
(
request
):
res
=
{}
if
CagetteUser
.
are_credentials_ok
(
request
):
...
...
members/static/js/admin/manage_regular_shifts.js
View file @
1d62cd4b
...
...
@@ -293,7 +293,7 @@ $(document).ready(function() {
let
search_str
=
$
(
'#search_member_input'
).
val
();
$
.
ajax
({
url
:
'/members/search/'
+
search_str
,
url
:
`/members/search/
${
search_str
}
?search_type=shift_template_data`
,
dataType
:
'json'
,
success
:
function
(
data
)
{
$
(
'#partner_data_area'
).
hide
();
...
...
reception/static/js/reception_produits.js
View file @
1d62cd4b
...
...
@@ -1085,6 +1085,7 @@ function set_supplier_shortage(row, product, from_processed = false) {
product
.
old_qty
=
product
.
product_qty
;
}
product
.
product_qty
=
0
;
product
.
package_qty
=
0
;
// Step 2: for consistency purposes, updated products need these fields to be set
}
else
{
if
(
!
from_processed
)
{
...
...
reception/views.py
View file @
1d62cd4b
...
...
@@ -329,7 +329,7 @@ def save_error_report(request):
}
else
:
# Read step 1 data from couch db document
order_id
=
f
"order_{order['name'].split('PO')[1]}"
order_id
=
'order_'
+
str
(
order
[
'id'
])
order_doc
=
c_db
.
getDocById
(
order_id
)
try
:
...
...
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