Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
chris
repanier
Commits
37976f33
Commit
37976f33
authored
Mar 21, 2017
by
Patrick
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Better display momentum of a producer minimal order amount
parent
9b4185bf
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
10 deletions
+5
-10
repanier/tools.py
repanier/tools.py
+5
-10
No files found.
repanier/tools.py
View file @
37976f33
...
...
@@ -1010,20 +1010,15 @@ def update_or_create_purchase(customer=None, offer_item_id=None, q_order=None, v
producer_invoice
=
models
.
ProducerInvoice
.
objects
.
filter
(
producer_id
=
offer_item
.
producer_id
,
permanence_id
=
offer_item
.
permanence_id
).
only
(
"total_price_with_tax"
).
order_by
(
'?'
).
first
()
if
producer_invoice
is
None
:
ratio
=
0
else
:
if
offer_item
.
producer
.
minimum_order_value
.
amount
==
DECIMAL_ZERO
:
ratio
=
100
else
:
ratio
=
producer_invoice
.
total_price_with_tax
.
amount
/
offer_item
.
producer
.
minimum_order_value
.
amount
if
producer_invoice
is
not
None
and
offer_item
.
producer
.
minimum_order_value
.
amount
>
DECIMAL_ZERO
:
ratio
=
producer_invoice
.
total_price_with_tax
.
amount
/
offer_item
.
producer
.
minimum_order_value
.
amount
if
ratio
>=
DECIMAL_ONE
:
ratio
=
100
else
:
ratio
*=
100
option_dict
=
{
'id'
:
"#order_procent"
+
str
(
offer_item
.
producer_id
),
'html'
:
"%s%%"
%
number_format
(
ratio
,
0
)}
to_json
.
append
(
option_dict
)
option_dict
=
{
'id'
:
"#order_procent"
+
str
(
offer_item
.
producer_id
),
'html'
:
"%s%%"
%
number_format
(
ratio
,
0
)}
to_json
.
append
(
option_dict
)
elif
not
batch_job
:
# Select one purchase
purchase
=
models
.
Purchase
.
objects
.
filter
(
...
...
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