ERPNext Conference 2019* ERPNext.com Blog

Payment Reconciliation Error for Party Type Employee

bug

#1

When we are trying to use payment reconciliation for the Party Type Employee, we are getting the following error in ERPNext: v12.1.2 (version-12) Frappe Framework: v12.0.12 (version-12)

self.add_payment_entries(payment_entries + journal_entries + dr_or_cr_notes)
UnboundLocalError: local variable ‘dr_or_cr_notes’ referenced before assignment

The problem is in code dr_or_cr_notes is defined only for Customer or Supplier and not for others.

self.check_mandatory_to_fetch()

            payment_entries = self.get_payment_entries()
            journal_entries = self.get_jv_entries()

            if self.party_type in ["Customer", "Supplier"]:
                    dr_or_cr_notes = self.get_dr_or_cr_notes()

            self.add_payment_entries(payment_entries + journal_entries + dr_or_cr_notes)

Suggested correction

self.check_mandatory_to_fetch()

            payment_entries = self.get_payment_entries()
            journal_entries = self.get_jv_entries()
            entry_list = payment_entries + journal_entries
            if self.party_type in ["Customer", "Supplier"]:
                    dr_or_cr_notes = self.get_dr_or_cr_notes()
                    entry_list = entry_list + dr_or_cr_notes

            self.add_payment_entries(entry_list)

-Amit


#2

I am having the same issue. please advise how to solve