fix quote payments show
This commit is contained in:
		
							parent
							
								
									169a9bd624
								
							
						
					
					
						commit
						dd64b7b47c
					
				
					 2 changed files with 6 additions and 6 deletions
				
			
		| 
						 | 
				
			
			@ -137,11 +137,11 @@ class Quote(NameSlugModel):
 | 
			
		|||
        return '<span class="badge bg-{}">{}</span>'.format(color, self.get_status_display())
 | 
			
		||||
 | 
			
		||||
    def get_paid_amount(self):
 | 
			
		||||
        """مبلغ پرداخت شده برای این پیشفاکتور بر اساس پرداختهای فاکتور مرتبط"""
 | 
			
		||||
        """خالص پرداختی (دریافتی از مشتری منهای پرداختی به مشتری) برای این پیشفاکتور بر اساس پرداختهای فاکتور مرتبط"""
 | 
			
		||||
        invoice = Invoice.objects.filter(quote=self).first()
 | 
			
		||||
        if not invoice:
 | 
			
		||||
            return Decimal('0')
 | 
			
		||||
        return sum(p.amount for p in invoice.payments.filter(is_deleted=False).all())
 | 
			
		||||
        return sum((p.amount if p.direction == 'in' else -p.amount) for p in invoice.payments.filter(is_deleted=False).all())
 | 
			
		||||
 | 
			
		||||
    def get_remaining_amount(self):
 | 
			
		||||
        """مبلغ باقیمانده بر اساس پرداختها"""
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue