refs #1753 Fixed: Incorrect next number for a new document in the module

This commit is contained in:
Cüneyt Şentürk 2021-01-13 19:07:13 +03:00
parent 703dcd0170
commit c50c8acd75

View File

@ -550,8 +550,18 @@ abstract class DocumentForm extends Base
return $document->document_number;
}
$document_number = $this->getNextDocumentNumber($type);
$next = $type;
if ($alias = config('type.' . $type . '.alias')) {
$next = $alias . '.' . $type;
}
$document_number = $this->getNextDocumentNumber($next);
if (empty($document_number)) {
$document_number = $this->getNextDocumentNumber($type);
}
if (empty($document_number)) {
$document_number = $this->getNextDocumentNumber(Document::INVOICE_TYPE);
}