Skip to content

Commit

Permalink
refactor(test): AR output filtered on USD customers
Browse files Browse the repository at this point in the history
  • Loading branch information
ruthra-kumar committed Sep 18, 2023
1 parent 083c82c commit 08d91ab
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def setUp(self):
def tearDown(self):
frappe.db.rollback()

def test_accounts_receivable_with_supplier(self):
def test_accounts_payable_for_foreign_currency_supplier(self):
pi = self.create_purchase_invoice(do_not_submit=True)
pi.currency = "USD"
pi.conversion_rate = 80
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -568,3 +568,40 @@ def test_party_account_filter(self):
row.account_currency,
],
)

def test_usd_customer_filter(self):
filters = {
"company": self.company,
"party_type": "Customer",
"party": self.customer,
"report_date": today(),
"range1": 30,
"range2": 60,
"range3": 90,
"range4": 120,
}

si = self.create_sales_invoice(no_payment_schedule=True, do_not_submit=True)
si.currency = "USD"
si.conversion_rate = 80
si.debit_to = self.debtors_usd
si.save().submit()
name = si.name

# check invoice grand total and invoiced column's value for 3 payment terms
report = execute(filters)

expected = {
"voucher_type": si.doctype,
"voucher_no": si.name,
"party_account": self.debtors_usd,
"customer_name": self.customer,
"invoiced": 100.0,
"outstanding": 100.0,
"account_currency": "USD",
}
self.assertEqual(len(report[1]), 1)
report_output = report[1][0]
for field in expected:
with self.subTest(field=field):
self.assertEqual(report_output.get(field), expected.get(field))

0 comments on commit 08d91ab

Please sign in to comment.