app/models/invoice.rb in erp_invoicing-3.0.5 vs app/models/invoice.rb in erp_invoicing-3.0.6
- old
+ new
@@ -57,9 +57,11 @@
def calculate_balance
unless self.calculate_balance_strategy_type.nil?
case self.calculate_balance_strategy_type.internal_identifier
when 'invoice_items_and_payments'
(self.items.all.sum(&:total_amount) - self.total_payments)
+ when 'payable_balances_and_payments'
+ (self.payable_balances.all.sum(&:balance).amount - self.total_payments)
when 'payments'
(self.balance - self.total_payments)
else
self.balance
end