[fix] [tests] test_delivery_note

This commit is contained in:
Rushabh Mehta 2017-06-20 10:07:28 +05:30
parent 36311020de
commit 80ef298519
2 changed files with 17 additions and 47 deletions

View File

@ -26,7 +26,7 @@ class TestDeliveryNote(unittest.TestCase):
target_warehouse = "_Test Warehouse 1 - _TC"
company = "_Test Company"
if not frappe.db.exists("Account", target_warehouse):
parent_account = frappe.db.get_value('Account',
parent_account = frappe.db.get_value('Account',
{'company': company, 'is_group':1, 'account_type': 'Stock'},'name')
account = create_account(account_name="_Test Warehouse 1", \
account_type="Stock", parent_account= parent_account, company=company)
@ -275,11 +275,20 @@ class TestDeliveryNote(unittest.TestCase):
def test_return_entire_bundled_items(self):
set_perpetual_inventory()
create_stock_reconciliation(item_code="_Test Item", target="_Test Warehouse - _TC", qty=50, rate=100)
create_stock_reconciliation(item_code="_Test Item Home Desktop 100", target="_Test Warehouse - _TC",
qty=50, rate=100)
create_stock_reconciliation(item_code="_Test Item",
target="_Test Warehouse - _TC", qty=50, rate=100)
create_stock_reconciliation(item_code="_Test Item Home Desktop 100",
target="_Test Warehouse - _TC", qty=50, rate=100)
dn = create_delivery_note(item_code="_Test Product Bundle Item", qty=5, rate=500)
actual_qty = get_qty_after_transaction()
self.assertEquals(actual_qty, 50)
dn = create_delivery_note(item_code="_Test Product Bundle Item",
qty=5, rate=500)
# qty after return
actual_qty = get_qty_after_transaction()
self.assertEquals(actual_qty, 25)
# return bundled item
dn1 = create_delivery_note(item_code='_Test Product Bundle Item', is_return=1,
@ -532,9 +541,9 @@ class TestDeliveryNote(unittest.TestCase):
def create_delivery_note(**args):
dn = frappe.new_doc("Delivery Note")
args = frappe._dict(args)
dn.posting_date = args.posting_date or today()
if args.posting_time:
dn.posting_time = args.posting_time
dn.posting_date = args.posting_date or nowdate()
dn.posting_time = args.posting_time or nowtime()
dn.set_posting_time = 1
dn.company = args.company or "_Test Company"
dn.customer = args.customer or "_Test Customer"

View File

@ -1,39 +0,0 @@
[
{
"company": "_Test Company",
"conversion_rate": 1.0,
"currency": "INR",
"customer": "_Test Customer",
"customer_name": "_Test Customer",
"items": [
{
"base_amount": 100.0,
"base_rate": 100.0,
"cost_center": "Main - _TC",
"description": "CPU",
"doctype": "Delivery Note Item",
"expense_account": "Cost of Goods Sold - _TC",
"item_code": "_Test Item",
"item_name": "_Test Item",
"parentfield": "items",
"qty": 1.0,
"rate": 100.0,
"uom": "_Test UOM",
"conversion_factor": 1,
"stock_uom": "_Test UOM",
"warehouse": "_Test Warehouse - _TC"
}
],
"doctype": "Delivery Note",
"base_grand_total": 100.0,
"grand_total": 100.0,
"naming_series": "_T-Delivery Note-",
"base_net_total": 100.0,
"plc_conversion_rate": 1.0,
"posting_date": "2013-02-21",
"price_list_currency": "INR",
"selling_price_list": "_Test Price List",
"status": "Draft",
"territory": "_Test Territory"
}
]