fix shift_sale double update
This commit is contained in:
@@ -633,9 +633,10 @@ class SalePayment < ApplicationRecord
|
||||
|
||||
def sale_update_payment_status(paid_amount, check_foc = false)
|
||||
#update amount_outstanding
|
||||
if ['completed'].include? sale.sale_status
|
||||
if !self.sale || ['completed'].include?(self.sale.sale_status)
|
||||
return
|
||||
end
|
||||
|
||||
sale = self.sale
|
||||
sale_payments = sale.sale_payments.reload
|
||||
|
||||
@@ -681,17 +682,8 @@ class SalePayment < ApplicationRecord
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
sale.save!
|
||||
|
||||
sale.save!
|
||||
|
||||
if check_foc
|
||||
table_update_status(sale)
|
||||
update_shift
|
||||
elsif paid_amount.to_f > 0 #|| paid_amount != "0.0"
|
||||
table_update_status(sale)
|
||||
update_shift
|
||||
elsif paid_amount.to_f == 0 && !is_credit
|
||||
table_update_status(sale)
|
||||
update_shift
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user