1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2025-03-03 00:29:17 +01:00

(bug) unable to update product low stock alert

This commit is contained in:
Du Peng 2025-01-27 10:48:33 +01:00
parent f24056aa54
commit 2e5581351a
2 changed files with 3 additions and 1 deletions

View File

@ -2,6 +2,8 @@
## Next release
- Fix a bug: unable to update product low stock alert
## v6.3.37 2025 January 22
- updated rails to 7.0.8.7

View File

@ -195,7 +195,7 @@ class ProductService
return product unless product.low_stock_alert
return product unless product.low_stock_threshold
affected_stocks = stock_movements&.map { |m| m[:stock_type] }&.uniq
affected_stocks = stock_movements&.compact_blank&.map { |m| m[:stock_type] }&.uniq
if (product.stock['internal'] <= product.low_stock_threshold && affected_stocks&.include?('internal')) ||
(product.stock['external'] <= product.low_stock_threshold && affected_stocks&.include?('external'))
NotificationCenter.call type: 'notify_admin_low_stock_threshold',