StockMovement
StockMovement
A StockMovement is created whenever stock of a particular ProductVariant goes in or out.
Signature
class StockMovement extends VendureEntity {
@Column({ nullable: false, type: 'varchar' })
readonly type: StockMovementType;
@Index()
@ManyToOne(type => ProductVariant, variant => variant.stockMovements)
productVariant: ProductVariant;
@Index()
@ManyToOne(type => StockLocation, stockLocation => stockLocation.stockMovements, { onDelete: 'CASCADE' })
stockLocation: StockLocation;
@EntityId()
stockLocationId: ID;
@Column()
quantity: number;
}
- Extends:
VendureEntity
type
property
StockMovementType
productVariant
property
stockLocation
property
stockLocationId
property
quantity
property
number
Allocation
An Allocation is created for each ProductVariant in an Order when the checkout is completed (as configured by the StockAllocationStrategy. This prevents stock being sold twice.
Signature
class Allocation extends StockMovement {
readonly type = StockMovementType.ALLOCATION;
constructor(input: DeepPartial<Allocation>)
@Index()
@ManyToOne(type => OrderLine, orderLine => orderLine.allocations)
orderLine: OrderLine;
}
- Extends:
StockMovement
Cancellation
A Cancellation is created when OrderItems from a fulfilled Order are cancelled.
Signature
class Cancellation extends StockMovement {
readonly type = StockMovementType.CANCELLATION;
constructor(input: DeepPartial<Cancellation>)
@ManyToOne(type => OrderLine, orderLine => orderLine.cancellations)
orderLine: OrderLine;
}
- Extends:
StockMovement
Release
A Release is created when OrderItems which have been allocated (but not yet fulfilled) are cancelled.
Signature
class Release extends StockMovement {
readonly type = StockMovementType.RELEASE;
constructor(input: DeepPartial<Release>)
@ManyToOne(type => OrderLine)
orderLine: OrderLine;
}
- Extends:
StockMovement
Sale
A Sale is created when OrderItems are fulfilled.
Signature
class Sale extends StockMovement {
readonly type = StockMovementType.SALE;
constructor(input: DeepPartial<Sale>)
@ManyToOne(type => OrderLine, line => line.sales)
orderLine: OrderLine;
}
- Extends:
StockMovement
StockAdjustment
A StockAdjustment is created when the stockOnHand
level of a ProductVariant is manually adjusted.
Signature
class StockAdjustment extends StockMovement {
readonly type = StockMovementType.ADJUSTMENT;
constructor(input: DeepPartial<StockAdjustment>)
}
- Extends:
StockMovement