Inventory Issue
This commit is contained in:
@@ -63,6 +63,7 @@ class Sale < ApplicationRecord
|
||||
end
|
||||
end
|
||||
def generate_invoice_from_booking(booking_id, requested_by, cashier, order_source = nil, current_checkin_induties_count)
|
||||
saleObj =''
|
||||
booking = Booking.find(booking_id)
|
||||
status = false
|
||||
Rails.logger.debug "Booking -> " + booking.id.to_s
|
||||
@@ -71,13 +72,17 @@ class Sale < ApplicationRecord
|
||||
#get all order attached to this booking and combine into 1 invoice
|
||||
|
||||
booking.booking_orders.each do |order|
|
||||
# puts "Hello order"
|
||||
if booking.sale_id
|
||||
status, sale_id = generate_invoice_from_order(order.order_id, nil, booking, requested_by, cashier, order_source)
|
||||
status, sale_id = generate_invoice_from_order(order.order_id, nil, booking, requested_by, cashier, order_source)
|
||||
else
|
||||
status, sale_id = generate_invoice_from_order(order.order_id, booking.sale_id, booking, requested_by, cashier, order_source)
|
||||
status, sale_id = generate_invoice_from_order(order.order_id, booking.sale_id, booking, requested_by, cashier, order_source)
|
||||
end
|
||||
booking.sale_id = sale_id
|
||||
saleObj = Sale.find(sale_id)
|
||||
end
|
||||
# InventoryJob.perform_now(self.id)
|
||||
InventoryDefinition.calculate_product_count(saleObj)
|
||||
|
||||
order = booking.booking_orders.take.order
|
||||
link_order_sale(order.id)
|
||||
@@ -225,7 +230,7 @@ class Sale < ApplicationRecord
|
||||
|
||||
# InventoryJob.perform_now(self.id)
|
||||
saleObj = Sale.find(self.id)
|
||||
InventoryDefinition.calculate_product_count(saleObj)
|
||||
# InventoryDefinition.calculate_product_count(saleObj)
|
||||
|
||||
return true, self.id
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user