fixed duplicate other payment

This commit is contained in:
NyanLinHtut
2019-12-27 19:45:40 +06:30
parent 23f922b5d1
commit 9ac6749efb

View File

@@ -662,7 +662,7 @@ class SalePayment < ApplicationRecord
is_credit = sale.sale_payments.any? { |x| x.payment_method == "creditnote" }
is_foc = sale.sale_payments.any? { |x| x.payment_method == "foc" }
if (sale.grand_total <= all_received_amount)
if sale.grand_total <= all_received_amount && sale.sale_status == "new"
sale.payment_status = "paid"
if is_credit
sale.payment_status = "outstanding"