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
8b25f8a3
Commit
8b25f8a3
authored
Jul 02, 2021
by
Damien Moulard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix add one product
parent
da96a62e
Pipeline
#1141
passed with stage
in 1 minute 21 seconds
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
4 deletions
+4
-4
models.py
products/models.py
+4
-4
No files found.
products/models.py
View file @
8b25f8a3
...
@@ -468,7 +468,7 @@ class CagetteProducts(models.Model):
...
@@ -468,7 +468,7 @@ class CagetteProducts(models.Model):
try
:
try
:
today
=
datetime
.
date
.
today
()
.
strftime
(
"
%
Y-
%
m-
%
d"
)
today
=
datetime
.
date
.
today
()
.
strftime
(
"
%
Y-
%
m-
%
d"
)
if
len
(
supplier_ids
)
>
0
:
if
supplier_ids
is
not
None
and
len
(
supplier_ids
)
>
0
:
# Get products/supplier relation
# Get products/supplier relation
f
=
[
"product_tmpl_id"
,
'date_start'
,
'date_end'
,
'package_qty'
,
'price'
,
'name'
]
f
=
[
"product_tmpl_id"
,
'date_start'
,
'date_end'
,
'package_qty'
,
'price'
,
'name'
]
c
=
[[
'name'
,
'in'
,
[
int
(
x
)
for
x
in
supplier_ids
]]]
c
=
[[
'name'
,
'in'
,
[
int
(
x
)
for
x
in
supplier_ids
]]]
...
@@ -503,8 +503,8 @@ class CagetteProducts(models.Model):
...
@@ -503,8 +503,8 @@ class CagetteProducts(models.Model):
sales_average_params
=
{
sales_average_params
=
{
'ids'
:
ptids
,
'ids'
:
ptids
,
'from'
:
'2019-04-10'
,
#
'from': '2019-04-10',
'to'
:
'2019-08-10'
,
#
'to': '2019-08-10',
}
}
sales
=
CagetteProducts
.
get_template_products_sales_average
(
sales_average_params
)
sales
=
CagetteProducts
.
get_template_products_sales_average
(
sales_average_params
)
...
@@ -515,7 +515,7 @@ class CagetteProducts(models.Model):
...
@@ -515,7 +515,7 @@ class CagetteProducts(models.Model):
# Add supplier data to product data
# Add supplier data to product data
for
i
,
fp
in
enumerate
(
filtered_products_t
):
for
i
,
fp
in
enumerate
(
filtered_products_t
):
if
len
(
supplier_ids
)
>
0
:
if
supplier_ids
is
not
None
and
len
(
supplier_ids
)
>
0
:
psi_item
=
next
(
item
for
item
in
psi
if
item
[
"product_tmpl_id"
]
is
not
False
and
item
[
"product_tmpl_id"
][
0
]
==
fp
[
"id"
])
psi_item
=
next
(
item
for
item
in
psi
if
item
[
"product_tmpl_id"
]
is
not
False
and
item
[
"product_tmpl_id"
][
0
]
==
fp
[
"id"
])
filtered_products_t
[
i
][
'suppliersinfo'
]
=
[{
filtered_products_t
[
i
][
'suppliersinfo'
]
=
[{
'supplier_id'
:
int
(
psi_item
[
"name"
][
0
]),
'supplier_id'
:
int
(
psi_item
[
"name"
][
0
]),
...
...
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