diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py index f798fabe3952..dd1b085c1cc1 100644 --- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py +++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py @@ -902,7 +902,7 @@ def make_supplier_gl_entry(self, gl_entries): self.add_supplier_gl_entry(gl_entries, base_grand_total, grand_total) def add_supplier_gl_entry( - self, gl_entries, base_grand_total, grand_total, against_account=None, remarks=None + self, gl_entries, base_grand_total, grand_total, against_account=None, remarks=None, skip_merge=False ): against_voucher = self.name if self.is_return and self.return_against and not self.update_outstanding_for_self: @@ -923,6 +923,7 @@ def add_supplier_gl_entry( "against_voucher_type": self.doctype, "project": self.project, "cost_center": self.cost_center, + "_skip_merge": skip_merge, } if remarks: @@ -1446,6 +1447,7 @@ def make_gl_entries_for_tax_withholding(self, gl_entries): -tds_amount, against_account=row.account_head, remarks=_("TDS Deducted"), + skip_merge=True, ) def make_payment_gl_entries(self, gl_entries): diff --git a/erpnext/accounts/general_ledger.py b/erpnext/accounts/general_ledger.py index 4ad0dc3e587a..37d9cfafa7ce 100644 --- a/erpnext/accounts/general_ledger.py +++ b/erpnext/accounts/general_ledger.py @@ -235,6 +235,10 @@ def merge_similar_entries(gl_map, precision=None): merge_properties = get_merge_properties(accounting_dimensions) for entry in gl_map: + if entry._skip_merge: + merged_gl_map.append(entry) + continue + entry.merge_key = get_merge_key(entry, merge_properties) # if there is already an entry in this account then just add it # to that entry @@ -291,7 +295,6 @@ def get_merge_properties(dimensions=None): "project", "finance_book", "voucher_no", - "against", ] if dimensions: merge_properties.extend(dimensions) diff --git a/erpnext/accounts/report/general_ledger/general_ledger.py b/erpnext/accounts/report/general_ledger/general_ledger.py index 204de6ea15bd..fdaf3fe2a598 100644 --- a/erpnext/accounts/report/general_ledger/general_ledger.py +++ b/erpnext/accounts/report/general_ledger/general_ledger.py @@ -516,7 +516,6 @@ def update_value_in_dict(data, key, gle): gle.get("account"), gle.get("party_type"), gle.get("party"), - gle.get("against"), ] if immutable_ledger: