mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2025-04-12 02:02:31 +02:00
(bug) unable to update product low stock alert
This commit is contained in:
parent
7be7b9780c
commit
327b460370
@ -5,6 +5,7 @@
|
|||||||
- updated rails to 7.0.8.7
|
- updated rails to 7.0.8.7
|
||||||
- updated tzinfo-data to 1.2025.1
|
- updated tzinfo-data to 1.2025.1
|
||||||
- Fix a bug: unable to update opening/closing time for the calendar
|
- Fix a bug: unable to update opening/closing time for the calendar
|
||||||
|
- Fix a bug: unable to update product low stock alert
|
||||||
|
|
||||||
## v6.3.36 2024 December 12
|
## v6.3.36 2024 December 12
|
||||||
|
|
||||||
|
@ -41,7 +41,7 @@ class ProductService
|
|||||||
# @param stock_movements [{stock_type: string, reason: string, quantity: number|string, order_item_id: number|nil}]
|
# @param stock_movements [{stock_type: string, reason: string, quantity: number|string, order_item_id: number|nil}]
|
||||||
def update_stock(product, stock_movements = nil)
|
def update_stock(product, stock_movements = nil)
|
||||||
remaining_stock = { internal: product.stock['internal'], external: product.stock['external'] }
|
remaining_stock = { internal: product.stock['internal'], external: product.stock['external'] }
|
||||||
product.product_stock_movements_attributes = stock_movements&.map do |movement|
|
product.product_stock_movements_attributes = stock_movements&.compact_blank&.map do |movement|
|
||||||
quantity = ProductStockMovement::OUTGOING_REASONS.include?(movement[:reason]) ? -movement[:quantity].to_i : movement[:quantity].to_i
|
quantity = ProductStockMovement::OUTGOING_REASONS.include?(movement[:reason]) ? -movement[:quantity].to_i : movement[:quantity].to_i
|
||||||
remaining_stock[movement[:stock_type].to_sym] += quantity
|
remaining_stock[movement[:stock_type].to_sym] += quantity
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user