tiny refactor of invoice setting logic

This commit is contained in:
tundebabzy 2018-03-01 17:15:46 +01:00
parent 9df4f0bd43
commit 16afa8765e

View File

@ -267,17 +267,16 @@ class Subscriptions(Document):
)
# Discounts
if self.apply_additional_discount:
invoice.apply_discount_on = self.apply_additional_discount
else:
invoice.apply_discount_on = 'Grand Total'
if self.additional_discount_percentage:
invoice.additional_discount_percentage = self.additional_discount_percentage
if self.additional_discount_amount:
invoice.additional_discount_amount = self.additional_discount_amount
if (self.additional_discount_percentage or self.additional_discount_amount) \
and not self.apply_additional_discount:
self.apply_additional_discount = 'Grand Total'
invoice.save()
invoice.submit()