fix in the product import

This commit is contained in:
2026-08-11 15:49:04 +05:30
parent c179e4d642
commit fba42259ea
7 changed files with 259 additions and 2 deletions

View File

@@ -161,6 +161,11 @@ type Locationproducts struct {
Approve int `json:"approve" gorm:"default:0"`
// Productstatus string `json:"productstatus" gorm:"default:available"`
Status string `json:"status" gorm:"default:outofstock"`
// Set only when the admin has released this product to the shops; NULL
// while it sits in the admin catalogue awaiting a price. This — not
// `Status` — is what a store view filters on. See models.Productlocations.
Publishedat *time.Time `json:"publishedat"`
}
type Productstocks struct {
@@ -341,6 +346,20 @@ type Productlocations struct {
Quantity int `json:"quantity" gorm:"<-:false"`
Stocktype string `json:"stocktype" gorm:"<-:false"`
Status string `json:"status"`
// When this product was released to the store, and the only thing that
// decides whether a store user can see it.
//
// NULL means the admin has imported it but not published it: it belongs to
// the admin catalogue alone. Deliberately NOT another `Status` value —
// syncProductLocationStatus rewrites that column on every stock movement,
// which is why the import's 'Draft' survived on one row out of 6,755.
//
// Read-only through this struct (`<-:false`). It is set by Publish and
// cleared by Unpublish, never as a side effect of an ordinary
// product-location write: setting a price must not be able to release a
// product to every shop in the tenant.
Publishedat *time.Time `json:"publishedat" gorm:"column:publishedat;<-:false"`
}
// ProductLocationRef identifies a single (tenant, location, product) row in