Commits

Anderson Santos  committed cb0ffc3

more fixes to taxes with discount

  • Participants
  • Parent commits 0e1ca27

Comments (0)

Files changed (2)

File satchmo/apps/satchmo_store/shop/models.py

     sub_total = property(_sub_total)
 
     def _total_with_tax(self):
-        return self.sub_total + self.tax
+        price = self.line_total
+        if self.discount:
+            price -= self.discount
+        return price + self.tax
     total_with_tax = property(_total_with_tax)
 
     def _unit_price_with_tax(self):

File satchmo/apps/tax/modules/percent/processor.py

 
     def by_orderitem(self, orderitem):
         if orderitem.product.taxable:
-            price = orderitem.sub_total
+            if config_value("TAX","INCLUDE_TAX_ON_DISCOUNTS"):
+                price = orderitem.line_total
+            else:
+                price = orderitem.sub_total
             return self.by_price(orderitem.product.taxClass, price)
         else:
             return Decimal("0.00")
         sub_total = Decimal("0.00")
         for item in order.orderitem_set.filter(product__taxable=True):
             if config_value("TAX","INCLUDE_TAX_ON_DISCOUNTS"):
-                sub_total += item.unit_price*item.quantity
+                sub_total += item.line_total
             else:
                 sub_total += item.sub_total