test: Updated test case for Eway bill
This commit is contained in:
parent
5265ba39f0
commit
b24a149dbc
@ -1908,6 +1908,8 @@ class TestSalesInvoice(unittest.TestCase):
|
|||||||
self.assertEqual(data['billLists'][0]['sgstValue'], 5400)
|
self.assertEqual(data['billLists'][0]['sgstValue'], 5400)
|
||||||
self.assertEqual(data['billLists'][0]['vehicleNo'], 'KA12KA1234')
|
self.assertEqual(data['billLists'][0]['vehicleNo'], 'KA12KA1234')
|
||||||
self.assertEqual(data['billLists'][0]['itemList'][0]['taxableAmount'], 60000)
|
self.assertEqual(data['billLists'][0]['itemList'][0]['taxableAmount'], 60000)
|
||||||
|
self.assertEqual(data['billLists'][0]['actualFromStateCode'],7)
|
||||||
|
self.assertEqual(data['billLists'][0]['fromStateCode'],27)
|
||||||
|
|
||||||
def test_einvoice_submission_without_irn(self):
|
def test_einvoice_submission_without_irn(self):
|
||||||
# init
|
# init
|
||||||
@ -2061,6 +2063,30 @@ def make_test_address_for_ewaybill():
|
|||||||
|
|
||||||
address.save()
|
address.save()
|
||||||
|
|
||||||
|
if not frappe.db.exists('Address', '_Test Dispatch-Address for Eway bill-Shipping'):
|
||||||
|
address = frappe.get_doc({
|
||||||
|
"address_line1": "_Test Dispatch Address Line 1",
|
||||||
|
"address_title": "_Test Dispatch-Address for Eway bill",
|
||||||
|
"address_type": "Shipping",
|
||||||
|
"city": "_Test City",
|
||||||
|
"state": "Test State",
|
||||||
|
"country": "India",
|
||||||
|
"doctype": "Address",
|
||||||
|
"is_primary_address": 0,
|
||||||
|
"phone": "+910000000000",
|
||||||
|
"gstin": "07AAACC1206D1ZI",
|
||||||
|
"gst_state": "Delhi",
|
||||||
|
"gst_state_number": "07",
|
||||||
|
"pincode": "1100101"
|
||||||
|
}).insert()
|
||||||
|
|
||||||
|
address.append("links", {
|
||||||
|
"link_doctype": "Company",
|
||||||
|
"link_name": "_Test Company"
|
||||||
|
})
|
||||||
|
|
||||||
|
address.save()
|
||||||
|
|
||||||
def make_test_transporter_for_ewaybill():
|
def make_test_transporter_for_ewaybill():
|
||||||
if not frappe.db.exists('Supplier', '_Test Transporter'):
|
if not frappe.db.exists('Supplier', '_Test Transporter'):
|
||||||
frappe.get_doc({
|
frappe.get_doc({
|
||||||
@ -2099,6 +2125,7 @@ def make_sales_invoice_for_ewaybill():
|
|||||||
si.distance = 2000
|
si.distance = 2000
|
||||||
si.company_address = "_Test Address for Eway bill-Billing"
|
si.company_address = "_Test Address for Eway bill-Billing"
|
||||||
si.customer_address = "_Test Customer-Address for Eway bill-Shipping"
|
si.customer_address = "_Test Customer-Address for Eway bill-Shipping"
|
||||||
|
si.dispatch_address_name = "_Test Dispatch-Address for Eway bill-Shipping"
|
||||||
si.vehicle_no = "KA12KA1234"
|
si.vehicle_no = "KA12KA1234"
|
||||||
si.gst_category = "Registered Regular"
|
si.gst_category = "Registered Regular"
|
||||||
si.mode_of_transport = 'Road'
|
si.mode_of_transport = 'Road'
|
||||||
|
@ -432,7 +432,7 @@ def get_ewb_data(dt, dn):
|
|||||||
billing_address = frappe.get_doc('Address', doc.customer_address)
|
billing_address = frappe.get_doc('Address', doc.customer_address)
|
||||||
|
|
||||||
#added dispatch address
|
#added dispatch address
|
||||||
dispatch_address = frappe.get_doc('Address', doc.dispatch_address_name)
|
dispatch_address = frappe.get_doc('Address', doc.dispatch_address_name) if doc.dispatch_address_name else company_address
|
||||||
shipping_address = frappe.get_doc('Address', doc.shipping_address_name)
|
shipping_address = frappe.get_doc('Address', doc.shipping_address_name)
|
||||||
|
|
||||||
data = get_address_details(data, doc, company_address, billing_address, dispatch_address)
|
data = get_address_details(data, doc, company_address, billing_address, dispatch_address)
|
||||||
@ -524,7 +524,7 @@ def get_gstins_for_company(company):
|
|||||||
def get_address_details(data, doc, company_address, billing_address, dispatch_address):
|
def get_address_details(data, doc, company_address, billing_address, dispatch_address):
|
||||||
data.fromPincode = validate_pincode(company_address.pincode, 'Company Address')
|
data.fromPincode = validate_pincode(company_address.pincode, 'Company Address')
|
||||||
data.fromStateCode = validate_state_code(company_address.gst_state_number, 'Company Address')
|
data.fromStateCode = validate_state_code(company_address.gst_state_number, 'Company Address')
|
||||||
data.actualFromStateCode = validate_state_code(dispatch_address.gst_state_number, 'Company Address')
|
data.actualFromStateCode = validate_state_code(dispatch_address.gst_state_number, 'Dispatch Address')
|
||||||
|
|
||||||
if not doc.billing_address_gstin or len(doc.billing_address_gstin) < 15:
|
if not doc.billing_address_gstin or len(doc.billing_address_gstin) < 15:
|
||||||
data.toGstin = 'URP'
|
data.toGstin = 'URP'
|
||||||
|
Loading…
x
Reference in New Issue
Block a user