close #861 Fixed: Sending an invoice sets the wrong "sent date"

This commit is contained in:
Cüneyt Şentürk
2020-03-25 18:09:52 +03:00
parent d8d27c2ba6
commit ee6041ecd1
4 changed files with 18 additions and 4 deletions

View File

@ -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;
}
}