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
310ce8a3
Commit
310ce8a3
authored
Mar 09, 2022
by
François C.
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Ticket 2473 : If a product stock value is 0 and sales average value is 0, set 1 package to order
parent
afe5a5e8
Pipeline
#1889
passed with stage
in 1 minute 29 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
7 deletions
+14
-7
orders_helper.js
orders/static/js/orders_helper.js
+14
-7
No files found.
orders/static/js/orders_helper.js
View file @
310ce8a3
...
...
@@ -191,15 +191,22 @@ function add_product() {
return
0
;
}
function
compute_purchase_qty_for_coverage
(
product
,
coeff
,
stock
,
incoming_qty
,
daily_conso
,
days
)
{
let
purchase_qty_for_coverage
=
null
;
purchase_qty_for_coverage
=
days
*
daily_conso
-
stock
-
incoming_qty
+
product
.
minimal_stock
;
purchase_qty_for_coverage
=
(
purchase_qty_for_coverage
<
0
)
?
0
:
purchase_qty_for_coverage
;
let
purchase_qty_for_coverage
=
0
,
purchase_package_qty_for_coverage
=
0
;
// Reduce to nb of packages to purchase
purchase_package_qty_for_coverage
=
purchase_qty_for_coverage
/
product
.
suppliersinfo
[
0
].
package_qty
;
if
(
stock
==
0
&&
daily_conso
==
0
)
{
purchase_package_qty_for_coverage
=
1
;
if
(
coeff
!=
1
)
{
purchase_package_qty_for_coverage
*=
coeff
;
}
else
{
purchase_qty_for_coverage
=
days
*
daily_conso
-
stock
-
incoming_qty
+
product
.
minimal_stock
;
purchase_qty_for_coverage
=
(
purchase_qty_for_coverage
<
0
)
?
0
:
purchase_qty_for_coverage
;
// Reduce to nb of packages to purchase
purchase_package_qty_for_coverage
=
purchase_qty_for_coverage
/
product
.
suppliersinfo
[
0
].
package_qty
;
if
(
coeff
!=
1
)
{
purchase_package_qty_for_coverage
*=
coeff
;
}
}
// return Round up to unit for all products
return
Math
.
ceil
(
purchase_package_qty_for_coverage
);
...
...
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