Merge pull request #22601 from deepeshgarg007/payment_reco_company

fix: Payment reco error in multi-company setup
This commit is contained in:
rohitwaghchaure 2020-07-07 15:32:36 +05:30 committed by GitHub
commit 546cfdaac2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -101,10 +101,10 @@ class PaymentReconciliation(Document):
Having Having
amount > 0 amount > 0
""".format( """.format(
doc=voucher_type, doc=voucher_type,
dr_or_cr=dr_or_cr, dr_or_cr=dr_or_cr,
reconciled_dr_or_cr=reconciled_dr_or_cr, reconciled_dr_or_cr=reconciled_dr_or_cr,
party_type_field=frappe.scrub(self.party_type)), party_type_field=frappe.scrub(self.party_type)),
{ {
'party': self.party, 'party': self.party,
'party_type': self.party_type, 'party_type': self.party_type,
@ -170,7 +170,7 @@ class PaymentReconciliation(Document):
reconcile_against_document(lst) reconcile_against_document(lst)
if dr_or_cr_notes: if dr_or_cr_notes:
reconcile_dr_cr_note(dr_or_cr_notes) reconcile_dr_cr_note(dr_or_cr_notes, self.company)
msgprint(_("Successfully Reconciled")) msgprint(_("Successfully Reconciled"))
self.get_unreconciled_entries() self.get_unreconciled_entries()
@ -261,7 +261,7 @@ class PaymentReconciliation(Document):
return cond return cond
def reconcile_dr_cr_note(dr_cr_notes): def reconcile_dr_cr_note(dr_cr_notes, company):
for d in dr_cr_notes: for d in dr_cr_notes:
voucher_type = ('Credit Note' voucher_type = ('Credit Note'
if d.voucher_type == 'Sales Invoice' else 'Debit Note') if d.voucher_type == 'Sales Invoice' else 'Debit Note')
@ -273,6 +273,7 @@ def reconcile_dr_cr_note(dr_cr_notes):
"doctype": "Journal Entry", "doctype": "Journal Entry",
"voucher_type": voucher_type, "voucher_type": voucher_type,
"posting_date": today(), "posting_date": today(),
"company": company,
"accounts": [ "accounts": [
{ {
'account': d.account, 'account': d.account,