close #861 Fixed: Sending an invoice sets the wrong "sent date"
This commit is contained in:
		@@ -101,4 +101,11 @@ class Bill extends DocumentModel
 | 
			
		||||
        $this->status = 'draft';
 | 
			
		||||
        $this->bill_number = $this->getNextBillNumber();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function getReceivedAtAttribute($value)
 | 
			
		||||
    {
 | 
			
		||||
        $received = $this->histories()->where('status', 'received')->first();
 | 
			
		||||
 | 
			
		||||
        return ($received) ? $received->created_at : null;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -108,4 +108,11 @@ class Invoice extends DocumentModel
 | 
			
		||||
        $this->status = 'draft';
 | 
			
		||||
        $this->invoice_number = $this->getNextInvoiceNumber();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function getSentAtAttribute($value)
 | 
			
		||||
    {
 | 
			
		||||
        $sent = $this->histories()->where('status', 'sent')->first();
 | 
			
		||||
 | 
			
		||||
        return ($sent) ? $sent->created_at : null;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user