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
269b53c3
Commit
269b53c3
authored
Jan 18, 2023
by
François C.
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix product coeff used to compute final price for shelf labels
parent
7efd741f
Pipeline
#2578
passed with stage
in 1 minute 28 seconds
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
2 deletions
+7
-2
models.py
orders/models.py
+7
-2
No files found.
orders/models.py
View file @
269b53c3
...
@@ -66,8 +66,8 @@ class Order(models.Model):
...
@@ -66,8 +66,8 @@ class Order(models.Model):
# Adding barcode and other data for every purchased product
# Adding barcode and other data for every purchased product
f
=
[
'barcode'
,
'product_tmpl_id'
,
'shelf_id'
]
f
=
[
'barcode'
,
'product_tmpl_id'
,
'shelf_id'
]
if
forExport
is
False
:
# i.e for reception
if
forExport
is
False
:
# i.e for reception
f
+=
[
'taxes_id'
,
'standard_price'
]
f
+=
[
'taxes_id'
,
'standard_price'
,
'coeff9_inter'
]
coeff
=
self
.
get_coop_main_coeff
()
# coeff = self.get_coop_main_coeff() : non, car ne prend en compte que la marge principale
c
=
[[
'id'
,
'in'
,
pids
]]
c
=
[[
'id'
,
'in'
,
pids
]]
res_bc
=
self
.
o_api
.
search_read
(
'product.product'
,
c
,
f
)
res_bc
=
self
.
o_api
.
search_read
(
'product.product'
,
c
,
f
)
tmpl_ids
=
[]
tmpl_ids
=
[]
...
@@ -95,6 +95,7 @@ class Order(models.Model):
...
@@ -95,6 +95,7 @@ class Order(models.Model):
for
l
in
res_bc
:
for
l
in
res_bc
:
for
p
in
res
:
for
p
in
res
:
if
p
[
'product_id'
][
0
]
==
l
[
'id'
]:
if
p
[
'product_id'
][
0
]
==
l
[
'id'
]:
# coop_logger.info(str(l))
p
[
'shelf_sortorder'
]
=
'X'
p
[
'shelf_sortorder'
]
=
'X'
p
[
'barcode'
]
=
l
[
'barcode'
]
p
[
'barcode'
]
=
l
[
'barcode'
]
p
[
'product_tmpl_id'
]
=
l
[
'product_tmpl_id'
][
0
]
p
[
'product_tmpl_id'
]
=
l
[
'product_tmpl_id'
][
0
]
...
@@ -102,7 +103,11 @@ class Order(models.Model):
...
@@ -102,7 +103,11 @@ class Order(models.Model):
p
[
'p_price'
]
=
l
[
'standard_price'
]
p
[
'p_price'
]
=
l
[
'standard_price'
]
p_coeff
=
None
p_coeff
=
None
try
:
try
:
# from standard_price to public price (Excluding taxes)
coeff
=
round
(
l
[
'coeff9_inter'
]
/
l
[
'standard_price'
],
2
)
# coeff9_inter is price at the last coeff. level
tax_coeff
=
(
1
+
(
float
(
taxes
[
str
(
l
[
'taxes_id'
][
0
])]))
/
100
)
tax_coeff
=
(
1
+
(
float
(
taxes
[
str
(
l
[
'taxes_id'
][
0
])]))
/
100
)
# Set total coeff (margin and taxes)
p_coeff
=
coeff
*
tax_coeff
p_coeff
=
coeff
*
tax_coeff
except
Exception
as
e
:
except
Exception
as
e
:
coop_logger
.
warning
(
'order get_lines :
%
s'
,
str
(
e
))
coop_logger
.
warning
(
'order get_lines :
%
s'
,
str
(
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