1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2025-02-07 01:54:16 +01:00

set default value of order_item_id in update_stock

This commit is contained in:
Du Peng 2022-08-26 14:08:20 +02:00
parent 8d52768031
commit e3dfe4935a

View File

@ -23,7 +23,7 @@ class ProductService
nil nil
end end
def self.update_stock(product, stock_type, reason, quantity, order_item_id) def self.update_stock(product, stock_type, reason, quantity, order_item_id = nil)
remaining_stock = product.stock[stock_type] + quantity remaining_stock = product.stock[stock_type] + quantity
product.product_stock_movements.create(stock_type: stock_type, reason: reason, quantity: quantity, remaining_stock: remaining_stock, product.product_stock_movements.create(stock_type: stock_type, reason: reason, quantity: quantity, remaining_stock: remaining_stock,
date: DateTime.current, date: DateTime.current,