A Spree::StockMovement
object is created every time that a stock item moves in
or out of a stock location. This objects documents how many items were added or
removed.
The Spree::StockMovement
model has the following attributes:
stock_item_id
: The ID of the Spree::StockItem
the movement is related to.quantity
: The amount of stock items added or removed from the
Spree::StockItem
's count_on_hand
value.originator_type
and originator_id
: The model and ID of an object that
initiated the creation of the current stock movement. For example, an
originator could be an administrator (a Spree::User
) adding new stock or a
Spree::Shipment
being created after an order is placed. A typical example of a stock movement would be when a customer buys an item from your store:
count_on_hand
value of 20
.Spree::StockMovement
object is created.
quantity
of -1
.originator_type
of Spree::Shipment
because a new shipment
triggered the movement.count_on_hand
value is updated to 19
. Administrators can generate stock movements by changing the "Count On Hand"
value for a stock item in the solidus_backend
(on the Stock page).
However, they cannot create a stock movement directly.
Because of this, Solidus has no concept of adding to existing inventory. For example:
count_on_hand
value of 7
.7
to 33
.Spree::StockMovement
with a quantity of 25
. (7 + 25 =
33
.)If an administrator does not account for the units already in stock, they may enter the wrong value into the "Count On Hand" field for an item.
For example, if the administrator changes the value from 7
to 25
, then the
stock movement only documents that 18
units were added to inventory. (7 + 18
= 25
.)
Solidus is an open source platform supported by the community. We encourage everyone using Solidus to contribute back to the documentation and the code.
If you’re interested in contributing to the docs, get started with the contributing guidelines. If you see something that needs fixing and can’t do it yourself, please send us an email.