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
e0c4556b
Commit
e0c4556b
authored
Jun 30, 2021
by
François
Committed by
Alexis Aoun
Jul 06, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add sigma and void percent days in products data
parent
ac2d271f
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
5 deletions
+8
-5
models.py
products/models.py
+8
-5
No files found.
products/models.py
View file @
e0c4556b
...
@@ -506,8 +506,12 @@ class CagetteProducts(models.Model):
...
@@ -506,8 +506,12 @@ class CagetteProducts(models.Model):
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"
]
sales
=
CagetteProducts
.
get_template_products_sales_average
({
'ids'
:
ptids
,
'from'
:
'2019-06-10'
,
'to'
:
'2020-08-10'
})
sales_average_params
=
{
'ids'
:
ptids
,
# sales = CagetteProducts.get_template_products_sales_average({'ids': ptids})
#'from': '2019-06-10',
#'to': '2019-08-10',
}
sales
=
CagetteProducts
.
get_template_products_sales_average
(
sales_average_params
)
if
'list'
in
sales
and
len
(
sales
[
'list'
])
>
0
:
if
'list'
in
sales
and
len
(
sales
[
'list'
])
>
0
:
sales
=
sales
[
'list'
]
sales
=
sales
[
'list'
]
else
:
else
:
...
@@ -525,9 +529,8 @@ class CagetteProducts(models.Model):
...
@@ -525,9 +529,8 @@ class CagetteProducts(models.Model):
for
s
in
sales
:
for
s
in
sales
:
if
s
[
"id"
]
==
fp
[
"id"
]:
if
s
[
"id"
]
==
fp
[
"id"
]:
filtered_products_t
[
i
][
'daily_conso'
]
=
s
[
"average_qty"
]
filtered_products_t
[
i
][
'daily_conso'
]
=
s
[
"average_qty"
]
filtered_products_t
[
i
][
'sigma'
]
=
s
[
"sigma"
]
if
not
'daily_conso'
in
filtered_products_t
[
i
]:
filtered_products_t
[
i
][
'vpc'
]
=
s
[
"vpc"
]
filtered_products_t
[
i
][
'daily_conso'
]
=
0
res
[
"products"
]
=
filtered_products_t
res
[
"products"
]
=
filtered_products_t
except
Exception
as
e
:
except
Exception
as
e
:
...
...
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