From e2fdff57776e6627a6cc66565c6ff6440f2def6f Mon Sep 17 00:00:00 2001 From: Deepesh Garg Date: Tue, 7 Jul 2020 14:14:07 +0530 Subject: [PATCH] fix: Payment reco error in multicompany setup --- .../payment_reconciliation.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.py b/erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.py index 3080496186..8dc28e878c 100644 --- a/erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.py +++ b/erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.py @@ -101,10 +101,10 @@ class PaymentReconciliation(Document): Having amount > 0 """.format( - doc=voucher_type, - dr_or_cr=dr_or_cr, - reconciled_dr_or_cr=reconciled_dr_or_cr, - party_type_field=frappe.scrub(self.party_type)), + doc=voucher_type, + dr_or_cr=dr_or_cr, + reconciled_dr_or_cr=reconciled_dr_or_cr, + party_type_field=frappe.scrub(self.party_type)), { 'party': self.party, 'party_type': self.party_type, @@ -170,7 +170,7 @@ class PaymentReconciliation(Document): reconcile_against_document(lst) if dr_or_cr_notes: - reconcile_dr_cr_note(dr_or_cr_notes) + reconcile_dr_cr_note(dr_or_cr_notes, self.receivable_payable_account) msgprint(_("Successfully Reconciled")) self.get_unreconciled_entries() @@ -261,7 +261,8 @@ class PaymentReconciliation(Document): return cond -def reconcile_dr_cr_note(dr_cr_notes): +def reconcile_dr_cr_note(dr_cr_notes, receivable_payable_account): + company = frappe.db.get_value('Account', receivable_payable_account, 'company') for d in dr_cr_notes: voucher_type = ('Credit Note' if d.voucher_type == 'Sales Invoice' else 'Debit Note') @@ -273,6 +274,7 @@ def reconcile_dr_cr_note(dr_cr_notes): "doctype": "Journal Entry", "voucher_type": voucher_type, "posting_date": today(), + "company": company, "accounts": [ { 'account': d.account,