bug fixes and improvements

This commit is contained in:
Thein Lin Kyaw
2019-09-30 16:53:02 +06:30
parent faa0acee6d
commit 94a1f5b2b5
4 changed files with 20 additions and 22 deletions

View File

@@ -15,8 +15,6 @@ class OrderItem < ApplicationRecord
after_save :update_stock_journal
# after_update :update_stock_journal
# after_save :add_to_journal, if: Proc.new { !self.id_changed? }
# after_save :update_stock_journal, if: Proc.new { self.id_changed? }
@@ -127,7 +125,7 @@ class OrderItem < ApplicationRecord
end
def update_stock_journal
if self.qty != self.qty_was
if self.qty != self.qty_before_last_save
found, inventory_definition = InventoryDefinition.find_product_in_inventory(self)
if found
InventoryDefinition.check_balance(self, inventory_definition)