diff --git a/erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.py b/erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.py index f7b8a77efa9..ee12fce7a94 100644 --- a/erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.py +++ b/erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.py @@ -47,6 +47,10 @@ class PaymentReconciliation(Document): def get_payment_entries(self): order_doctype = "Sales Order" if self.party_type == "Customer" else "Purchase Order" condition = self.get_conditions(get_payments=True) + + if self.get("cost_center"): + condition += " and cost_center = '{0}' ".format(self.cost_center) + payment_entries = get_advance_payment_entries( self.party_type, self.party, @@ -61,6 +65,10 @@ class PaymentReconciliation(Document): def get_jv_entries(self): condition = self.get_conditions() + + if self.get("cost_center"): + condition += " and t2.cost_center = '{0}' ".format(self.cost_center) + dr_or_cr = ( "credit_in_account_currency" if erpnext.get_party_account_type(self.party_type) == "Receivable" @@ -113,6 +121,10 @@ class PaymentReconciliation(Document): def get_dr_or_cr_notes(self): condition = self.get_conditions(get_return_invoices=True) + + if self.get("cost_center"): + condition += " and doc.cost_center = '{0}' ".format(self.cost_center) + dr_or_cr = ( "credit_in_account_currency" if erpnext.get_party_account_type(self.party_type) == "Receivable" @@ -172,6 +184,9 @@ class PaymentReconciliation(Document): condition = self.get_conditions(get_invoices=True) + if self.get("cost_center"): + condition += " and cost_center = '{0}' ".format(self.cost_center) + non_reconciled_invoices = get_outstanding_invoices( self.party_type, self.party, self.receivable_payable_account, condition=condition ) @@ -357,9 +372,6 @@ class PaymentReconciliation(Document): def get_conditions(self, get_invoices=False, get_payments=False, get_return_invoices=False): condition = " and company = '{0}' ".format(self.company) - if self.get("cost_center"): - condition = " and cost_center = '{0}' ".format(self.cost_center) - if get_invoices: condition += ( " and posting_date >= {0}".format(frappe.db.escape(self.from_invoice_date))