mirror of
https://github.com/frappe/erpnext.git
synced 2026-02-20 09:56:31 +00:00
Revert "fix: Show Credit Note amount in credit note column"
This commit is contained in:
@@ -38,23 +38,6 @@ class TestAccountsPayable(AccountsTestMixin, IntegrationTestCase):
|
||||
self.assertEqual(data[1][0].get("outstanding"), 300)
|
||||
self.assertEqual(data[1][0].get("currency"), "USD")
|
||||
|
||||
def test_account_payable_for_debit_note(self):
|
||||
pi = self.create_purchase_invoice(do_not_submit=True)
|
||||
pi.is_return = 1
|
||||
pi.items[0].qty = -1
|
||||
pi = pi.save().submit()
|
||||
|
||||
filters = {
|
||||
"company": self.company,
|
||||
"party_type": "Supplier",
|
||||
"party": [self.supplier],
|
||||
"report_date": today(),
|
||||
"range": "30, 60, 90, 120",
|
||||
}
|
||||
|
||||
data = execute(filters)
|
||||
self.assertEqual(data[1][0].get("invoiced"), 300)
|
||||
|
||||
def create_purchase_invoice(self, do_not_submit=False):
|
||||
frappe.set_user("Administrator")
|
||||
pi = make_purchase_invoice(
|
||||
|
||||
@@ -267,18 +267,6 @@ class ReceivablePayableReport:
|
||||
row.invoiced_in_account_currency += amount_in_account_currency
|
||||
else:
|
||||
if self.is_invoice(ple):
|
||||
# when invoice has is_return marked
|
||||
if self.invoice_details.get(row.voucher_no, {}).get("is_return"):
|
||||
# for Credit Note
|
||||
if row.voucher_type == "Sales Invoice":
|
||||
row.credit_note -= amount
|
||||
row.credit_note_in_account_currency -= amount_in_account_currency
|
||||
# for Debit Note
|
||||
else:
|
||||
row.invoiced -= amount
|
||||
row.invoiced_in_account_currency -= amount_in_account_currency
|
||||
return
|
||||
|
||||
if row.voucher_no == ple.voucher_no == ple.against_voucher_no:
|
||||
row.paid -= amount
|
||||
row.paid_in_account_currency -= amount_in_account_currency
|
||||
@@ -433,7 +421,7 @@ class ReceivablePayableReport:
|
||||
# nosemgrep
|
||||
si_list = frappe.db.sql(
|
||||
"""
|
||||
select name, due_date, po_no, is_return
|
||||
select name, due_date, po_no
|
||||
from `tabSales Invoice`
|
||||
where posting_date <= %s
|
||||
and company = %s
|
||||
@@ -465,7 +453,7 @@ class ReceivablePayableReport:
|
||||
# nosemgrep
|
||||
for pi in frappe.db.sql(
|
||||
"""
|
||||
select name, due_date, bill_no, bill_date, is_return
|
||||
select name, due_date, bill_no, bill_date
|
||||
from `tabPurchase Invoice`
|
||||
where
|
||||
posting_date <= %s
|
||||
|
||||
@@ -204,7 +204,7 @@ class TestAccountsReceivable(AccountsTestMixin, IntegrationTestCase):
|
||||
|
||||
expected_data_after_credit_note = [
|
||||
[100.0, 100.0, 40.0, 0.0, 60.0, si.name],
|
||||
[0, 0, 0, 100.0, -100.0, cr_note.name],
|
||||
[0, 0, 100.0, 0.0, -100.0, cr_note.name],
|
||||
]
|
||||
self.assertEqual(len(report[1]), 2)
|
||||
si_row = next(
|
||||
@@ -478,19 +478,13 @@ class TestAccountsReceivable(AccountsTestMixin, IntegrationTestCase):
|
||||
report = execute(filters)[1]
|
||||
self.assertEqual(len(report), 2)
|
||||
|
||||
expected_data = {sr.name: [0.0, 10.0, -10.0, 0.0, -10], si.name: [100.0, 0.0, 100.0, 10.0, 90.0]}
|
||||
expected_data = {sr.name: [10.0, -10.0, 0.0, -10], si.name: [100.0, 100.0, 10.0, 90.0]}
|
||||
|
||||
rows = report[:2]
|
||||
for row in rows:
|
||||
self.assertEqual(
|
||||
expected_data[row.voucher_no],
|
||||
[
|
||||
row.invoiced or row.paid,
|
||||
row.credit_note,
|
||||
row.outstanding,
|
||||
row.remaining_balance,
|
||||
row.future_amount,
|
||||
],
|
||||
[row.invoiced or row.paid, row.outstanding, row.remaining_balance, row.future_amount],
|
||||
)
|
||||
|
||||
pe.cancel()
|
||||
|
||||
Reference in New Issue
Block a user