diff --git a/pkg/models/document.go b/pkg/models/document.go index 757ebe3f9..a6376bfc1 100644 --- a/pkg/models/document.go +++ b/pkg/models/document.go @@ -260,6 +260,7 @@ func GetLatestProductNumber(db *gorm.DB, DocumentTypeID: dt.ID, ProductID: p.ID, }). + Where("document_number IS NOT NULL"). Order("document_number desc"). First(&d). Error; err != nil {