fix: add cost center in gl entry for advance payment entry (#27840) (#27915)

(cherry picked from commit 569dc5f6b1)

Co-authored-by: Afshan <33727827+AfshanKhan@users.noreply.github.com>
This commit is contained in:
mergify[bot]
2021-10-12 14:31:50 +05:30
committed by GitHub
parent c5660e8511
commit 6f786b42a9

View File

@@ -712,10 +712,14 @@ class PaymentEntry(AccountsController):
dr_or_cr = "credit" if erpnext.get_party_account_type(self.party_type) == 'Receivable' else "debit"
for d in self.get("references"):
cost_center = self.cost_center
if d.reference_doctype == "Sales Invoice" and not cost_center:
cost_center = frappe.db.get_value(d.reference_doctype, d.reference_name, "cost_center")
gle = party_gl_dict.copy()
gle.update({
"against_voucher_type": d.reference_doctype,
"against_voucher": d.reference_name
"against_voucher": d.reference_name,
"cost_center": cost_center
})
allocated_amount_in_company_currency = flt(flt(d.allocated_amount) * flt(d.exchange_rate),