Removed the autodiscount functionality on OrderItem

parent 18a63cb8
...@@ -43,12 +43,6 @@ class OrderItem(models.Model): ...@@ -43,12 +43,6 @@ class OrderItem(models.Model):
prod.quantity -= self.quantity prod.quantity -= self.quantity
prod.save() prod.save()
if(self.is_successful): if(self.is_successful):
discounts = product_model.Discount.objects.all()
for discount in discounts:
if(self.item_id == discount.item_id and discount.start_date <= date.today() and
discount.end_date >= date.today()):
self.discount = discount.discount_percent
self.discount_price = self.item_id.price * (1 - (self.discount/100))
self.sub_total= self.discount_price * self.quantity self.sub_total= self.discount_price * self.quantity
self.order_no.amount_due += Decimal(self.sub_total) self.order_no.amount_due += Decimal(self.sub_total)
self.order_no.save() self.order_no.save()
......
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