fix order model invoice genrator
This commit is contained in:
+19
-1
@@ -250,7 +250,25 @@ class OrderItemModel(models.Model):
|
||||
|
||||
def __str__(self):
|
||||
return f'({self.product}) - ({self.order.user})'
|
||||
|
||||
|
||||
# @property
|
||||
def total_price_before_discount(self):
|
||||
return self.price * self.quantity
|
||||
|
||||
# @property
|
||||
def total_product_discount_amount(self):
|
||||
if self.discount_percent > 0:
|
||||
return int((self.price * self.quantity) * (self.discount_percent / 100))
|
||||
return 0
|
||||
|
||||
# @property
|
||||
def price_after_special_discount(self):
|
||||
all_discounts = (self.special_discount_amount or 0) + self.total_product_discount_amount()
|
||||
print(all_discounts)
|
||||
return self.total_price_before_discount() - all_discounts
|
||||
|
||||
def unit_price(self):
|
||||
return self.price
|
||||
|
||||
class ShopOrderModel(models.Model):
|
||||
"""Represents the portion of a customer Order that belongs to a single Shop.
|
||||
|
||||
Reference in New Issue
Block a user