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 @Column({ nullable: false, type: 'varchar' })
readonly type: StockMovementType;
@Index() @ManyToOne(type => ProductVariant, variant => variant.stockMovements) @Index()
@ManyToOne(type => ProductVariant, variant => variant.stockMovements)
productVariant: ProductVariant;
@Index() @ManyToOne(type => StockLocation, { onDelete: 'CASCADE' }) @Index()
@ManyToOne(type => StockLocation, { onDelete: 'CASCADE' })
stockLocation: StockLocation;
@EntityId() @EntityId()
stockLocationId: ID;
@Column() @Column()
quantity: number;
}
Extends
Members
type
property
type:
StockMovementType
productVariant
property
type:
ProductVariant
stockLocation
property
type:
StockLocation
stockLocationId
property
type:
ID
quantity
property
type:
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 readonly type = StockMovementType.ALLOCATION;
constructor(input: DeepPartial<Allocation>)
@Index() @ManyToOne(type => OrderLine) @Index()
@ManyToOne(type => OrderLine)
orderLine: OrderLine;
}
Extends
Members
type
property
type:
constructor
method
type:
(input: DeepPartial<Allocation>) => Allocation
orderLine
property
type:
OrderLine
Cancellation
A Cancellation is created when OrderItems from a fulfilled Order are cancelled.
Signature
class Cancellation extends StockMovement {
readonly readonly type = StockMovementType.CANCELLATION;
constructor(input: DeepPartial<Cancellation>)
@ManyToOne(type => OrderLine) @ManyToOne(type => OrderLine)
orderLine: OrderLine;
}
Extends
Members
type
property
type:
constructor
method
type:
(input: DeepPartial<Cancellation>) => Cancellation
orderLine
property
type:
OrderLine
Release
A Release is created when OrderItems which have been allocated (but not yet fulfilled) are cancelled.
Signature
class Release extends StockMovement {
readonly readonly type = StockMovementType.RELEASE;
constructor(input: DeepPartial<Release>)
@ManyToOne(type => OrderLine) @ManyToOne(type => OrderLine)
orderLine: OrderLine;
}
Extends
Members
type
property
type:
constructor
method
type:
(input: DeepPartial<Release>) => Release
orderLine
property
type:
OrderLine
Sale
A Sale is created when OrderItems are fulfilled.
Signature
class Sale extends StockMovement {
readonly readonly type = StockMovementType.SALE;
constructor(input: DeepPartial<Sale>)
@ManyToOne(type => OrderLine) @ManyToOne(type => OrderLine)
orderLine: OrderLine;
}
Extends
Members
type
property
type:
constructor
method
type:
(input: DeepPartial<Sale>) => Sale
orderLine
property
type:
OrderLine
StockAdjustment
A StockAdjustment is created when the stockOnHand
level of a ProductVariant is manually adjusted.
Signature
class StockAdjustment extends StockMovement {
readonly readonly type = StockMovementType.ADJUSTMENT;
constructor(input: DeepPartial<StockAdjustment>)
}
Extends
Members
type
property
type:
constructor
method
type:
(input: DeepPartial<StockAdjustment>) => StockAdjustment