mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-26 08:24:47 +00:00
fix: Updated test_united_states
This commit is contained in:
@@ -26,7 +26,7 @@ def execute(filters=None):
|
|||||||
s.supplier_group as "supplier_group",
|
s.supplier_group as "supplier_group",
|
||||||
gl.party AS "supplier",
|
gl.party AS "supplier",
|
||||||
s.tax_id as "tax_id",
|
s.tax_id as "tax_id",
|
||||||
SUM(gl.debit) AS "payments"
|
SUM(gl.debit_in_account_currency) AS "payments"
|
||||||
FROM
|
FROM
|
||||||
`tabGL Entry` gl INNER JOIN `tabSupplier` s
|
`tabGL Entry` gl INNER JOIN `tabSupplier` s
|
||||||
WHERE
|
WHERE
|
||||||
|
|||||||
@@ -8,28 +8,34 @@ from erpnext.regional.report.irs_1099.irs_1099 import execute as execute_1099_re
|
|||||||
|
|
||||||
class TestUnitedStates(unittest.TestCase):
|
class TestUnitedStates(unittest.TestCase):
|
||||||
def test_irs_1099_custom_field(self):
|
def test_irs_1099_custom_field(self):
|
||||||
doc = frappe.new_doc("Supplier")
|
|
||||||
doc.supplier_name = "_US 1099 Test Supplier"
|
frappe.db.sql("delete from `tabGL Entry` where party='_US 1099 Test Supplier'")
|
||||||
doc.supplier_group = "Services"
|
frappe.db.sql("delete from `tabGL Entry` where against='_US 1099 Test Supplier'")
|
||||||
doc.supplier_type = "Company"
|
frappe.db.sql("delete from `tabPayment Entry` where party='_US 1099 Test Supplier'")
|
||||||
doc.country = "United States"
|
|
||||||
doc.tax_id = "04-1234567"
|
if not frappe.db.exists("Supplier", "_US 1099 Test Supplier"):
|
||||||
doc.irs_1099 = 1
|
doc = frappe.new_doc("Supplier")
|
||||||
doc.save()
|
doc.supplier_name = "_US 1099 Test Supplier"
|
||||||
frappe.db.commit()
|
doc.supplier_group = "Services"
|
||||||
supplier = frappe.get_doc('Supplier', "_US 1099 Test Supplier")
|
doc.supplier_type = "Company"
|
||||||
self.assertEqual(supplier.irs_1099, 1)
|
doc.country = "United States"
|
||||||
|
doc.tax_id = "04-1234567"
|
||||||
|
doc.irs_1099 = 1
|
||||||
|
doc.save()
|
||||||
|
frappe.db.commit()
|
||||||
|
supplier = frappe.get_doc('Supplier', "_US 1099 Test Supplier")
|
||||||
|
self.assertEqual(supplier.irs_1099, 1)
|
||||||
|
|
||||||
def test_irs_1099_report(self):
|
def test_irs_1099_report(self):
|
||||||
make_payment_entry_to_irs_1099_supplier()
|
make_payment_entry_to_irs_1099_supplier()
|
||||||
filters = frappe._dict({"fiscal_year": "2016", "company": "_Test Company"})
|
filters = frappe._dict({"fiscal_year": "_Test Fiscal Year 2016", "company": "_Test Company"})
|
||||||
columns, data = execute_1099_report(filters)
|
columns, data = execute_1099_report(filters)
|
||||||
print(columns, data)
|
print(columns, data)
|
||||||
expected_row = {'supplier': '_US 1099 Test Supplier',
|
expected_row = {'supplier': '_US 1099 Test Supplier',
|
||||||
'supplier_group': 'Services',
|
'supplier_group': 'Services',
|
||||||
'payments': 100.0,
|
'payments': 100.0,
|
||||||
'tax_id': '04-1234567'}
|
'tax_id': '04-1234567'}
|
||||||
self.assertEqual(data, expected_row)
|
self.assertEqual(data[0], expected_row)
|
||||||
|
|
||||||
|
|
||||||
def make_payment_entry_to_irs_1099_supplier():
|
def make_payment_entry_to_irs_1099_supplier():
|
||||||
@@ -45,4 +51,5 @@ def make_payment_entry_to_irs_1099_supplier():
|
|||||||
pe.reference_date = "2016-01-10"
|
pe.reference_date = "2016-01-10"
|
||||||
pe.party_type = "Supplier"
|
pe.party_type = "Supplier"
|
||||||
pe.party = "_US 1099 Test Supplier"
|
pe.party = "_US 1099 Test Supplier"
|
||||||
pe.save()
|
pe.insert()
|
||||||
|
pe.submit()
|
||||||
|
|||||||
Reference in New Issue
Block a user