[fix] ignore journal entry based invoice in payment tool and payment reconciliation tool

This commit is contained in:
Anand Doshi 2015-09-16 12:46:54 +05:30
parent c19afa140d
commit 0b031cdd6c
3 changed files with 13 additions and 9 deletions

View File

@ -79,6 +79,7 @@ class PaymentReconciliation(Document):
`tabGL Entry`
where
party_type = %(party_type)s and party = %(party)s
and voucher_type != "Journal Entry"
and account = %(account)s and {dr_or_cr} > 0 {cond}
group by voucher_type, voucher_no
""".format(**{

View File

@ -71,7 +71,7 @@ def get_outstanding_vouchers(args):
# Get all outstanding sales /purchase invoices
outstanding_invoices = get_outstanding_invoices(amount_query, args.get("party_account"),
args.get("party_type"), args.get("party"))
args.get("party_type"), args.get("party"), with_journal_entry=False)
# Get all SO / PO which are not fully billed or aginst which full advance not paid
orders_to_be_billed = get_orders_to_be_billed(args.get("party_type"), args.get("party"),

View File

@ -392,7 +392,7 @@ def get_stock_rbnb_difference(posting_date, company):
# Amount should be credited
return flt(stock_rbnb) + flt(sys_bal)
def get_outstanding_invoices(amount_query, account, party_type, party):
def get_outstanding_invoices(amount_query, account, party_type, party, with_journal_entry=True):
all_outstanding_vouchers = []
outstanding_voucher_list = frappe.db.sql("""
select
@ -420,6 +420,9 @@ def get_outstanding_invoices(amount_query, account, party_type, party):
payment_amount = -1*payment_amount[0][0] if payment_amount else 0
precision = frappe.get_precision("Sales Invoice", "outstanding_amount")
if not with_journal_entry and d.voucher_type=="Journal Entry":
continue
if d.invoice_amount > payment_amount:
all_outstanding_vouchers.append({