README.md in unidom-inventory-0.6 vs README.md in unidom-inventory-0.7
- old
+ new
@@ -48,13 +48,13 @@
pick_list = Unidom::Inventory::PickList.create!
pick_item = pick_list.items.create! inventory_item: grouped_inventory_item, quantity: 100
item_issuing = Unidom::Inventory::ItemIssuing.create! pick_item: pick_item, inventory_item: grouped_inventory_item, target_item: nil
# target_item could be nil or any model like: shipment item or order item
-variance = Unidom::Inventory::InventoryItemVariance.create! inventory_item: grouped_inventory_item, reason: nil, opened_at: Time.now
+Unidom::Inventory::InventoryItemVariance.adjust! @inventory_item, quantity: 1, due_to: nil, at: Time.now, description: nil, instruction: nil
# or the following source code do the exact same thing.
-grouped_inventory_item.variances.create! quantity: 10, reason: nil, opened_at: Time.now
+grouped_inventory_item.is_adjusted! 10, due_to: nil, at: Time.now, description: nil, instruction: nil
```
## Include the Concerns
@@ -63,23 +63,24 @@
include Unidom::Inventory::AsInventoryItem
```
### As Inventory Item concern
-The As Inventory Item concern do the following tasks for the includer automatically:
+The As Inventory Item concern do the following tasks for the includer automatically:
1. Define the belongs_to :stored macro as: ``belongs_to :stored, polymorphic: true``
2. Define the belongs_to :store macro as: ``belongs_to :store, polymorphic: true``
3. Define the belongs_to :lot macro as: ``belongs_to :lot, class_name: 'Unidom::Inventory::Lot'``
-4. Define the has_many :pick_items macro as: ``has_many :pick_items, class_name: 'Unidom::Inventory::PickItem', as: :inventory_item``
-5. Define the has_many :variances macro as: ``has_many :variances, class_name: 'Unidom::Inventory::InventoryItemVariance', as: :inventory_item``
+4. Define the has_many :pick_items macro as: ``has_many :pick_items, class_name: 'Unidom::Inventory::PickItem', as: :inventory_item``
+5. Define the has_many :variances macro as: ``has_many :variances, class_name: 'Unidom::Inventory::InventoryItemVariance', as: :inventory_item``
+6. Define the #is_adjusted! method as: ``is_adjusted!(quantity, due_to: nil, at: Time.now, description: nil, instruction: nil)``
### As Store concern
-The As Store concern do the following tasks for the includer automatically:
+The As Store concern do the following tasks for the includer automatically:
1. Define the has_many :grouped_inventory_items macro as: ``has_many :grouped_inventory_items, class_name: 'Unidom::Inventory::GroupedInventoryItem', foreign_key: :store_id``
2. Define the has_many :serialized_inventory_items macro as: ``has_many :serialized_inventory_items, class_name: 'Unidom::Inventory::SerializedInventoryItem', foreign_key: :store_id``
### As Stored concern
-The As Stored concern do the following tasks for the includer automatically:
+The As Stored concern do the following tasks for the includer automatically:
1. Define the has_many :grouped_inventory_items macro as: ``has_many :grouped_inventory_items, class_name: 'Unidom::Inventory::GroupedInventoryItem', foreign_key: :stored_id``
2. Define the has_many :serialized_inventory_items macro as: ``has_many :serialized_inventory_items, class_name: 'Unidom::Inventory::SerializedInventoryItem', foreign_key: :stored_id``