mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-23 15:09:20 +00:00
Merge pull request #23175 from AfshanKhan/handle-irs
fix: IRS 1099 report
This commit is contained in:
@@ -16,9 +16,15 @@ from frappe.utils.jinja import render_template
|
|||||||
|
|
||||||
def execute(filters=None):
|
def execute(filters=None):
|
||||||
filters = filters if isinstance(filters, _dict) else _dict(filters)
|
filters = filters if isinstance(filters, _dict) else _dict(filters)
|
||||||
|
|
||||||
if not filters:
|
if not filters:
|
||||||
filters.setdefault('fiscal_year', get_fiscal_year(nowdate())[0])
|
filters.setdefault('fiscal_year', get_fiscal_year(nowdate())[0])
|
||||||
filters.setdefault('company', frappe.db.get_default("company"))
|
filters.setdefault('company', frappe.db.get_default("company"))
|
||||||
|
|
||||||
|
region = frappe.db.get_value("Company", fieldname = ["country"], filters = { "name": filters.company })
|
||||||
|
if region != 'United States':
|
||||||
|
return [],[]
|
||||||
|
|
||||||
data = []
|
data = []
|
||||||
columns = get_columns()
|
columns = get_columns()
|
||||||
data = frappe.db.sql("""
|
data = frappe.db.sql("""
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ class TestUnitedStates(unittest.TestCase):
|
|||||||
|
|
||||||
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": "_Test Fiscal Year 2016", "company": "_Test Company"})
|
filters = frappe._dict({"fiscal_year": "_Test Fiscal Year 2016", "company": "_Test Company 1"})
|
||||||
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',
|
||||||
@@ -42,10 +42,10 @@ def make_payment_entry_to_irs_1099_supplier():
|
|||||||
|
|
||||||
pe = frappe.new_doc("Payment Entry")
|
pe = frappe.new_doc("Payment Entry")
|
||||||
pe.payment_type = "Pay"
|
pe.payment_type = "Pay"
|
||||||
pe.company = "_Test Company"
|
pe.company = "_Test Company 1"
|
||||||
pe.posting_date = "2016-01-10"
|
pe.posting_date = "2016-01-10"
|
||||||
pe.paid_from = "_Test Bank USD - _TC"
|
pe.paid_from = "_Test Bank USD - _TC1"
|
||||||
pe.paid_to = "_Test Payable USD - _TC"
|
pe.paid_to = "_Test Payable USD - _TC1"
|
||||||
pe.paid_amount = 100
|
pe.paid_amount = 100
|
||||||
pe.received_amount = 100
|
pe.received_amount = 100
|
||||||
pe.reference_no = "For IRS 1099 testing"
|
pe.reference_no = "For IRS 1099 testing"
|
||||||
|
|||||||
Reference in New Issue
Block a user