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
285f694e
Commit
285f694e
authored
Jun 24, 2022
by
Damien Moulard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ALC: assign computed qty to supplier with highest priority
parent
5916f6b2
Pipeline
#2272
passed with stage
in 1 minute 23 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
5 deletions
+17
-5
oders_helper_style.css
orders/static/css/oders_helper_style.css
+1
-1
orders_helper.js
orders/static/js/orders_helper.js
+13
-2
models.py
products/models.py
+3
-2
No files found.
orders/static/css/oders_helper_style.css
View file @
285f694e
...
...
@@ -331,7 +331,7 @@
margin
:
15px
0
;
position
:
-webkit-sticky
;
position
:
sticky
;
top
:
1
4
0px
;
top
:
1
2
0px
;
z-index
:
5
;
pointer-events
:
none
;
}
...
...
orders/static/js/orders_helper.js
View file @
285f694e
...
...
@@ -298,9 +298,20 @@ function compute_and_affect_product_supplier_quantities(coeff, days) {
const
daily_conso
=
product
.
daily_conso
;
let
purchase_package_qty_for_coverage
=
compute_purchase_qty_for_coverage
(
product
,
coeff
,
stock
,
incoming_qty
,
daily_conso
,
days
);
// Set qty to purchase for first supplier only
// Set qty to purchase for supplier with higher priority
let
target_supplierinfo_index
=
0
;
let
min_sequence
=
Number
.
POSITIVE_INFINITY
;
// min sequence = higher priority
for
(
let
i
in
products
[
key
].
suppliersinfo
)
{
let
suppliersinfo_sequence
=
products
[
key
].
suppliersinfo
[
i
].
sequence
;
if
(
suppliersinfo_sequence
<
min_sequence
)
{
min_sequence
=
suppliersinfo_sequence
;
target_supplierinfo_index
=
i
;
}
}
products
[
key
].
suppliersinfo
[
0
].
qty
=
purchase_package_qty_for_coverage
;
products
[
key
].
suppliersinfo
[
target_supplierinfo_index
].
qty
=
purchase_package_qty_for_coverage
;
}
}
}
...
...
products/models.py
View file @
285f694e
...
...
@@ -607,7 +607,7 @@ class CagetteProducts(models.Model):
if
supplier_ids
is
not
None
and
len
(
supplier_ids
)
>
0
:
# Get products/supplier relation
f
=
[
"id"
,
"product_tmpl_id"
,
'date_start'
,
'date_end'
,
'package_qty'
,
'price'
,
'name'
,
'product_code'
]
f
=
[
"id"
,
"product_tmpl_id"
,
'date_start'
,
'date_end'
,
'package_qty'
,
'price'
,
'name'
,
'product_code'
,
'sequence'
]
c
=
[[
'name'
,
'in'
,
[
int
(
x
)
for
x
in
supplier_ids
]]]
psi
=
api
.
search_read
(
'product.supplierinfo'
,
c
,
f
)
...
...
@@ -669,7 +669,8 @@ class CagetteProducts(models.Model):
'supplier_id'
:
int
(
psi_item
[
"name"
][
0
]),
'package_qty'
:
psi_item
[
"package_qty"
],
'price'
:
psi_item
[
"price"
],
'product_code'
:
psi_item
[
"product_code"
]
'product_code'
:
psi_item
[
"product_code"
],
'sequence'
:
psi_item
[
"sequence"
]
})
for
s
in
sales
:
...
...
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