diff --git a/app/models/sale_payment.rb b/app/models/sale_payment.rb index 06350f6f..36bc6de3 100755 --- a/app/models/sale_payment.rb +++ b/app/models/sale_payment.rb @@ -722,7 +722,10 @@ class SalePayment < ApplicationRecord # update for shift with credit payment def update_shift_for_credit_payment shift_credit = ShiftSale.find_by_id(self.sale.shift_sale_id) - shift = ShiftSale.find_by_id(ShiftSale.current_shift) + shift = self.action_by.current_shift + if !shift.nil? + shift = ShiftSale.current_shift + end if !shift.nil? credit_payment_left = get_credit_payment_left[0].payment_amount.to_f if self.payment_method == "cash"