Skip to content

Commit

Permalink
refactor: post ledger entries based on toggle
Browse files Browse the repository at this point in the history
  • Loading branch information
ruthra-kumar committed Mar 12, 2024
1 parent 767f215 commit 77aac6f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -830,6 +830,10 @@ def make_supplier_gl_entry(self, gl_entries):
)

if grand_total and not self.is_internal_transfer():
against_voucher = self.name
if self.is_return and self.return_against and not self.update_outstanding_for_self:
against_voucher = self.return_against

# Did not use base_grand_total to book rounding loss gle
gl_entries.append(
self.get_gl_dict(
Expand All @@ -843,7 +847,7 @@ def make_supplier_gl_entry(self, gl_entries):
"credit_in_account_currency": base_grand_total
if self.party_account_currency == self.company_currency
else grand_total,
"against_voucher": self.name,
"against_voucher": against_voucher,
"against_voucher_type": self.doctype,
"project": self.project,
"cost_center": self.cost_center,
Expand Down
8 changes: 5 additions & 3 deletions erpnext/accounts/doctype/sales_invoice/sales_invoice.py
Original file line number Diff line number Diff line change
Expand Up @@ -1220,6 +1220,10 @@ def make_customer_gl_entry(self, gl_entries):
)

if grand_total and not self.is_internal_transfer():
against_voucher = self.name
if self.is_return and self.return_against and not self.update_outstanding_for_self:
against_voucher = self.return_against

# Did not use base_grand_total to book rounding loss gle
gl_entries.append(
self.get_gl_dict(
Expand All @@ -1233,9 +1237,7 @@ def make_customer_gl_entry(self, gl_entries):
"debit_in_account_currency": base_grand_total
if self.party_account_currency == self.company_currency
else grand_total,
"against_voucher": self.name
if self.is_return and self.return_against and self.update_outstanding_for_self
else self.return_against,
"against_voucher": against_voucher,
"against_voucher_type": self.doctype,
"cost_center": self.cost_center,
"project": self.project,
Expand Down

0 comments on commit 77aac6f

Please sign in to comment.