Skip to content

Commit

Permalink
test: add test case for so creating si via delivery trip with gst 94
Browse files Browse the repository at this point in the history
  • Loading branch information
shubham-DT committed Jan 17, 2025
1 parent 5897955 commit 8d76e4d
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions erpnext/selling/doctype/sales_order/test_sales_order.py
Original file line number Diff line number Diff line change
Expand Up @@ -4933,6 +4933,43 @@ def test_sales_order_delivery_trip_creating_si_with_returns_TC_S_093(self):
self.assertEqual(frappe.db.get_value('GL Entry', {'voucher_no': si.name, 'account': 'Sales - _TC'}, 'credit'), 5000)
self.assertEqual(frappe.db.get_value('GL Entry', {'voucher_no': si.name, 'account': 'Debtors - _TC'}, 'debit'), 5000)

def test_sales_order_delivery_trip_creating_si_with_gst_TC_S_094(self):
so = self.create_and_submit_sales_order_with_gst("_Test Item", qty=1, rate=5000)

dn = make_delivery_note(so.name)
dn.submit()

self.assertEqual(dn.status, "To Bill", "Delivery Note not created")
qty_change = frappe.db.get_value('Stock Ledger Entry', {'voucher_no': dn.name, 'warehouse': '_Test Warehouse - _TC', 'item_code': '_Test Item'},'actual_qty')
self.assertEqual(qty_change, -1)

driver, vehicle, add = get_transport_details(customer = "_Test Registered Customer")

from erpnext.stock.doctype.delivery_note.delivery_note import make_delivery_trip
trip = make_delivery_trip(dn.name)
trip.driver = driver.name
trip.vehicle = vehicle.name
trip.departure_time = frappe.utils.now()
for i in trip.delivery_stops:
i.address = add.name
trip.save()
trip.submit()

self.assertEqual(trip.status, "Scheduled")

from erpnext.stock.doctype.delivery_note.delivery_note import (make_sales_invoice)

si = make_sales_invoice(dn.name)
si.save()
si.submit()
si.reload()
self.assertEqual(si.status, 'Unpaid')
self.assertEqual(frappe.db.get_value('GL Entry', {'voucher_no': si.name, 'account': 'Sales - _TC'}, 'credit'), 5000)
self.assertEqual(frappe.db.get_value('GL Entry', {'voucher_no': si.name, 'account': 'Debtors - _TC'}, 'debit'), 5000)

so.reload()
self.assertEqual(so.per_billed, 100)

def create_and_submit_sales_order(self, qty=None, rate=None):
sales_order = make_sales_order(cost_center='Main - _TC', selling_price_list='Standard Selling', do_not_save=True)
sales_order.delivery_date = nowdate()
Expand Down

0 comments on commit 8d76e4d

Please sign in to comment.