fix: Multi currency payment reconciliation (#22738)

* fix: Multi currency payment reconciliation

* fix: Hide currency link fields
This commit is contained in:
Deepesh Garg
2020-07-22 17:59:37 +05:30
committed by GitHub
parent f098221550
commit c7eadfceb0
7 changed files with 110 additions and 185 deletions

View File

@@ -1014,6 +1014,7 @@ def get_advance_journal_entries(party_type, party, party_account, amount_field,
def get_advance_payment_entries(party_type, party, party_account, order_doctype,
order_list=None, include_unallocated=True, against_all_orders=False, limit=None):
party_account_field = "paid_from" if party_type == "Customer" else "paid_to"
currency_field = "paid_from_account_currency" if party_type == "Customer" else "paid_to_account_currency"
payment_type = "Receive" if party_type == "Customer" else "Pay"
payment_entries_against_order, unallocated_payment_entries = [], []
limit_cond = "limit %s" % limit if limit else ""
@@ -1030,14 +1031,15 @@ def get_advance_payment_entries(party_type, party, party_account, order_doctype,
select
"Payment Entry" as reference_type, t1.name as reference_name,
t1.remarks, t2.allocated_amount as amount, t2.name as reference_row,
t2.reference_name as against_order, t1.posting_date
t2.reference_name as against_order, t1.posting_date,
t1.{0} as currency
from `tabPayment Entry` t1, `tabPayment Entry Reference` t2
where
t1.name = t2.parent and t1.{0} = %s and t1.payment_type = %s
t1.name = t2.parent and t1.{1} = %s and t1.payment_type = %s
and t1.party_type = %s and t1.party = %s and t1.docstatus = 1
and t2.reference_doctype = %s {1}
order by t1.posting_date {2}
""".format(party_account_field, reference_condition, limit_cond),
and t2.reference_doctype = %s {2}
order by t1.posting_date {3}
""".format(currency_field, party_account_field, reference_condition, limit_cond),
[party_account, payment_type, party_type, party,
order_doctype] + order_list, as_dict=1)