Commit 37976f33 authored by Patrick's avatar Patrick

Better display momentum of a producer minimal order amount

parent 9b4185bf
......@@ -1010,12 +1010,7 @@ 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:
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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment