mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-29 18:04:46 +00:00
[fix] [cleanup] fixes while testing and code cleanup
This commit is contained in:
@@ -50,10 +50,6 @@ class DocType(SellingController):
|
||||
'keyword': 'Delivered'
|
||||
}]
|
||||
|
||||
def validate_fiscal_year(self):
|
||||
get_obj('Sales Common').validate_fiscal_year(self.doc.fiscal_year,self.doc.posting_date,'Posting Date')
|
||||
|
||||
|
||||
def get_contact_details(self):
|
||||
return get_obj('Sales Common').get_contact_details(self,0)
|
||||
|
||||
@@ -104,7 +100,6 @@ class DocType(SellingController):
|
||||
utilities.validate_status(self.doc.status, ["Draft", "Submitted", "Cancelled"])
|
||||
|
||||
self.so_required()
|
||||
self.validate_fiscal_year()
|
||||
self.validate_proj_cust()
|
||||
sales_com_obj = get_obj(dt = 'Sales Common')
|
||||
sales_com_obj.check_stop_sales_order(self)
|
||||
@@ -122,7 +117,6 @@ class DocType(SellingController):
|
||||
self.validate_with_previous_doc()
|
||||
|
||||
self.doc.status = 'Draft'
|
||||
if not self.doc.billing_status: self.doc.billing_status = 'Not Billed'
|
||||
if not self.doc.installation_status: self.doc.installation_status = 'Not Installed'
|
||||
|
||||
def validate_with_previous_doc(self):
|
||||
|
||||
@@ -140,7 +140,7 @@ test_records = [
|
||||
"basic_rate": 100.0,
|
||||
"export_rate": 100.0,
|
||||
"amount": 500.0,
|
||||
"warehouse": "_Test Warehouse",
|
||||
"warehouse": "_Test Warehouse - _TC",
|
||||
"stock_uom": "No."
|
||||
}
|
||||
]
|
||||
|
||||
@@ -19,6 +19,7 @@ import unittest
|
||||
import webnotes
|
||||
|
||||
test_ignore = ["BOM"]
|
||||
test_dependencies = ["Warehouse"]
|
||||
|
||||
class TestItem(unittest.TestCase):
|
||||
def test_duplicate_price_list(self):
|
||||
@@ -41,7 +42,6 @@ class TestItem(unittest.TestCase):
|
||||
item.doc.is_stock_item = "Yes"
|
||||
item.doc.default_warehouse = None
|
||||
self.assertRaises(WarehouseNotSet, item.insert)
|
||||
|
||||
|
||||
test_records = [
|
||||
[{
|
||||
@@ -63,11 +63,11 @@ test_records = [
|
||||
"is_sub_contracted_item": "No",
|
||||
"stock_uom": "_Test UOM",
|
||||
"default_income_account": "Sales - _TC",
|
||||
"default_warehouse": "_Test Warehouse",
|
||||
"default_warehouse": "_Test Warehouse - _TC",
|
||||
}, {
|
||||
"doctype": "Item Reorder",
|
||||
"parentfield": "item_reorder",
|
||||
"warehouse": "_Test Warehouse",
|
||||
"warehouse": "_Test Warehouse - _TC",
|
||||
"warehouse_reorder_level": 20,
|
||||
"warehouse_reorder_qty": 20,
|
||||
"material_request_type": "Purchase"
|
||||
@@ -86,7 +86,7 @@ test_records = [
|
||||
"item_name": "_Test Item Home Desktop 100",
|
||||
"description": "_Test Item Home Desktop 100",
|
||||
"item_group": "_Test Item Group Desktops",
|
||||
"default_warehouse": "_Test Warehouse",
|
||||
"default_warehouse": "_Test Warehouse - _TC",
|
||||
"default_income_account": "Sales - _TC",
|
||||
"is_stock_item": "Yes",
|
||||
"is_asset_item": "No",
|
||||
@@ -112,7 +112,7 @@ test_records = [
|
||||
"item_name": "_Test Item Home Desktop 200",
|
||||
"description": "_Test Item Home Desktop 200",
|
||||
"item_group": "_Test Item Group Desktops",
|
||||
"default_warehouse": "_Test Warehouse",
|
||||
"default_warehouse": "_Test Warehouse - _TC",
|
||||
"default_income_account": "Sales - _TC",
|
||||
"is_stock_item": "Yes",
|
||||
"is_asset_item": "No",
|
||||
@@ -154,7 +154,7 @@ test_records = [
|
||||
"description": "_Test FG Item",
|
||||
"item_group": "_Test Item Group Desktops",
|
||||
"is_stock_item": "Yes",
|
||||
"default_warehouse": "_Test Warehouse",
|
||||
"default_warehouse": "_Test Warehouse - _TC",
|
||||
"default_income_account": "Sales - _TC",
|
||||
"is_asset_item": "No",
|
||||
"has_batch_no": "No",
|
||||
@@ -194,7 +194,7 @@ test_records = [
|
||||
"description": "_Test Serialized Item",
|
||||
"item_group": "_Test Item Group Desktops",
|
||||
"is_stock_item": "Yes",
|
||||
"default_warehouse": "_Test Warehouse",
|
||||
"default_warehouse": "_Test Warehouse - _TC",
|
||||
"is_asset_item": "No",
|
||||
"has_batch_no": "No",
|
||||
"has_serial_no": "Yes",
|
||||
|
||||
@@ -24,8 +24,6 @@ class DocType(BuyingController):
|
||||
def check_if_already_pulled(self):
|
||||
pass#if self.[d.sales_order_no for d in getlist(self.doclist, 'indent_details')]
|
||||
|
||||
# Validate so items
|
||||
# ----------------------------
|
||||
def validate_qty_against_so(self):
|
||||
so_items = {} # Format --> {'SO/00001': {'Item/001': 120, 'Item/002': 24}}
|
||||
for d in getlist(self.doclist, 'indent_details'):
|
||||
@@ -49,14 +47,6 @@ class DocType(BuyingController):
|
||||
if flt(so_items[so_no][item]) + already_indented > actual_so_qty:
|
||||
msgprint("You can raise indent of maximum qty: %s for item: %s against sales order: %s\n Anyway, you can add more qty in new row for the same item." % (actual_so_qty - already_indented, item, so_no), raise_exception=1)
|
||||
|
||||
|
||||
# Validate fiscal year
|
||||
# ----------------------------
|
||||
def validate_fiscal_year(self):
|
||||
get_obj(dt = 'Purchase Common').validate_fiscal_year(self.doc.fiscal_year,self.doc.transaction_date,'Material Request Date')
|
||||
|
||||
# Validate Schedule Date
|
||||
#--------------------------------
|
||||
def validate_schedule_date(self):
|
||||
#:::::::: validate schedule date v/s indent date ::::::::::::
|
||||
for d in getlist(self.doclist, 'indent_details'):
|
||||
@@ -70,7 +60,6 @@ class DocType(BuyingController):
|
||||
super(DocType, self).validate()
|
||||
|
||||
self.validate_schedule_date()
|
||||
self.validate_fiscal_year()
|
||||
|
||||
if not self.doc.status:
|
||||
self.doc.status = "Draft"
|
||||
|
||||
@@ -63,9 +63,9 @@ class TestMaterialRequest(unittest.TestCase):
|
||||
|
||||
def _test_requested_qty(self, qty1, qty2):
|
||||
self.assertEqual(flt(webnotes.conn.get_value("Bin", {"item_code": "_Test Item Home Desktop 100",
|
||||
"warehouse": "_Test Warehouse"}, "indented_qty")), qty1)
|
||||
"warehouse": "_Test Warehouse - _TC"}, "indented_qty")), qty1)
|
||||
self.assertEqual(flt(webnotes.conn.get_value("Bin", {"item_code": "_Test Item Home Desktop 200",
|
||||
"warehouse": "_Test Warehouse"}, "indented_qty")), qty2)
|
||||
"warehouse": "_Test Warehouse - _TC"}, "indented_qty")), qty2)
|
||||
|
||||
def _insert_stock_entry(self, qty1, qty2):
|
||||
se = webnotes.bean([
|
||||
@@ -87,7 +87,7 @@ class TestMaterialRequest(unittest.TestCase):
|
||||
"stock_uom": "_Test UOM",
|
||||
"transfer_qty": qty1,
|
||||
"uom": "_Test UOM",
|
||||
"t_warehouse": "_Test Warehouse 1",
|
||||
"t_warehouse": "_Test Warehouse 1 - _TC",
|
||||
},
|
||||
{
|
||||
"conversion_factor": 1.0,
|
||||
@@ -99,7 +99,7 @@ class TestMaterialRequest(unittest.TestCase):
|
||||
"stock_uom": "_Test UOM",
|
||||
"transfer_qty": qty2,
|
||||
"uom": "_Test UOM",
|
||||
"t_warehouse": "_Test Warehouse 1",
|
||||
"t_warehouse": "_Test Warehouse 1 - _TC",
|
||||
},
|
||||
])
|
||||
se.insert()
|
||||
@@ -148,7 +148,7 @@ class TestMaterialRequest(unittest.TestCase):
|
||||
po.cancel()
|
||||
# check if per complete is as expected
|
||||
mr.load_from_db()
|
||||
self._test_expected(mr.doclist, [{"per_ordered": 0}, {"ordered_qty": 0}, {"ordered_qty": 0}])
|
||||
self._test_expected(mr.doclist, [{"per_ordered": None}, {"ordered_qty": None}, {"ordered_qty": None}])
|
||||
self._test_requested_qty(54.0, 3.0)
|
||||
|
||||
def test_completed_qty_for_transfer(self):
|
||||
@@ -178,13 +178,13 @@ class TestMaterialRequest(unittest.TestCase):
|
||||
se_doclist[1].update({
|
||||
"qty": 27.0,
|
||||
"transfer_qty": 27.0,
|
||||
"s_warehouse": "_Test Warehouse 1",
|
||||
"s_warehouse": "_Test Warehouse 1 - _TC",
|
||||
"incoming_rate": 1.0
|
||||
})
|
||||
se_doclist[2].update({
|
||||
"qty": 1.5,
|
||||
"transfer_qty": 1.5,
|
||||
"s_warehouse": "_Test Warehouse 1",
|
||||
"s_warehouse": "_Test Warehouse 1 - _TC",
|
||||
"incoming_rate": 1.0
|
||||
})
|
||||
|
||||
@@ -241,13 +241,13 @@ class TestMaterialRequest(unittest.TestCase):
|
||||
se_doclist[1].update({
|
||||
"qty": 60.0,
|
||||
"transfer_qty": 60.0,
|
||||
"s_warehouse": "_Test Warehouse 1",
|
||||
"s_warehouse": "_Test Warehouse 1 - _TC",
|
||||
"incoming_rate": 1.0
|
||||
})
|
||||
se_doclist[2].update({
|
||||
"qty": 3.0,
|
||||
"transfer_qty": 3.0,
|
||||
"s_warehouse": "_Test Warehouse 1",
|
||||
"s_warehouse": "_Test Warehouse 1 - _TC",
|
||||
"incoming_rate": 1.0
|
||||
})
|
||||
|
||||
@@ -296,14 +296,14 @@ class TestMaterialRequest(unittest.TestCase):
|
||||
se_doclist[1].update({
|
||||
"qty": 60.0,
|
||||
"transfer_qty": 60.0,
|
||||
"s_warehouse": "_Test Warehouse",
|
||||
"t_warehouse": "_Test Warehouse 1",
|
||||
"s_warehouse": "_Test Warehouse - _TC",
|
||||
"t_warehouse": "_Test Warehouse 1 - _TC",
|
||||
"incoming_rate": 1.0
|
||||
})
|
||||
se_doclist[2].update({
|
||||
"qty": 3.0,
|
||||
"transfer_qty": 3.0,
|
||||
"s_warehouse": "_Test Warehouse 1",
|
||||
"s_warehouse": "_Test Warehouse 1 - _TC",
|
||||
"incoming_rate": 1.0
|
||||
})
|
||||
|
||||
@@ -336,7 +336,7 @@ test_records = [
|
||||
"qty": 54.0,
|
||||
"schedule_date": "2013-02-18",
|
||||
"uom": "_Test UOM",
|
||||
"warehouse": "_Test Warehouse"
|
||||
"warehouse": "_Test Warehouse - _TC"
|
||||
},
|
||||
{
|
||||
"description": "_Test Item Home Desktop 200",
|
||||
@@ -347,7 +347,7 @@ test_records = [
|
||||
"qty": 3.0,
|
||||
"schedule_date": "2013-02-19",
|
||||
"uom": "_Test UOM",
|
||||
"warehouse": "_Test Warehouse"
|
||||
"warehouse": "_Test Warehouse - _TC"
|
||||
}
|
||||
],
|
||||
]
|
||||
@@ -45,9 +45,6 @@ class DocType(BuyingController):
|
||||
'percent_join_field': 'prevdoc_docname',
|
||||
}]
|
||||
|
||||
def validate_fiscal_year(self):
|
||||
get_obj(dt = 'Purchase Common').validate_fiscal_year(self.doc.fiscal_year,self.doc.posting_date,'Transaction Date')
|
||||
|
||||
# get available qty at warehouse
|
||||
def get_bin_details(self, arg = ''):
|
||||
return get_obj(dt='Purchase Common').get_bin_details(arg)
|
||||
@@ -120,7 +117,6 @@ class DocType(BuyingController):
|
||||
super(DocType, self).validate()
|
||||
|
||||
self.po_required()
|
||||
self.validate_fiscal_year()
|
||||
|
||||
if not self.doc.status:
|
||||
self.doc.status = "Draft"
|
||||
|
||||
@@ -120,7 +120,7 @@ test_records = [
|
||||
"rejected_qty": 0.0,
|
||||
"import_rate": 50.0,
|
||||
"amount": 500.0,
|
||||
"warehouse": "_Test Warehouse",
|
||||
"warehouse": "_Test Warehouse - _TC",
|
||||
"stock_uom": "Nos",
|
||||
"uom": "_Test UOM",
|
||||
},
|
||||
@@ -168,7 +168,7 @@ test_records = [
|
||||
"posting_date": "2013-02-12",
|
||||
"posting_time": "15:33:30",
|
||||
"is_subcontracted": "Yes",
|
||||
"supplier_warehouse": "_Test Warehouse",
|
||||
"supplier_warehouse": "_Test Warehouse - _TC",
|
||||
"supplier": "_Test Supplier",
|
||||
"net_total": 5000.0,
|
||||
"grand_total": 5000.0,
|
||||
@@ -185,7 +185,7 @@ test_records = [
|
||||
"rejected_qty": 0.0,
|
||||
"import_rate": 500.0,
|
||||
"amount": 5000.0,
|
||||
"warehouse": "_Test Warehouse",
|
||||
"warehouse": "_Test Warehouse - _TC",
|
||||
"stock_uom": "Nos",
|
||||
"uom": "_Test UOM",
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ class TestSerialNo(unittest.TestCase):
|
||||
where voucher_type = 'Serial No' and voucher_no = %s""", sr.doc.name, as_dict=1)[0]
|
||||
self.assertTrue(sle)
|
||||
self.assertEquals([sle.item_code, sle.warehouse, sle.actual_qty],
|
||||
["_Test Serialized Item", "_Test Warehouse", 1.0])
|
||||
["_Test Serialized Item", "_Test Warehouse - _TC", 1.0])
|
||||
|
||||
# check gl entries
|
||||
gl_entries = webnotes.conn.sql("""select account, debit, credit
|
||||
@@ -92,7 +92,7 @@ test_records = [
|
||||
"status": "In Store",
|
||||
"item_code": "_Test Serialized Item",
|
||||
"item_group": "_Test Item Group",
|
||||
"warehouse": "_Test Warehouse",
|
||||
"warehouse": "_Test Warehouse - _TC",
|
||||
"purchase_rate": 1000.0,
|
||||
"purchase_time": "11:37:39",
|
||||
"purchase_date": "2013-02-26",
|
||||
|
||||
@@ -39,7 +39,7 @@ class TestStockEntry(unittest.TestCase):
|
||||
def test_warehouse_company_validation(self):
|
||||
from stock.doctype.stock_ledger_entry.stock_ledger_entry import InvalidWarehouseCompany
|
||||
st1 = webnotes.bean(copy=test_records[0])
|
||||
st1.doclist[1].t_warehouse="_Test Warehouse 2"
|
||||
st1.doclist[1].t_warehouse="_Test Warehouse 2 - _TC1"
|
||||
st1.insert()
|
||||
self.assertRaises(InvalidWarehouseCompany, st1.submit)
|
||||
|
||||
@@ -55,7 +55,7 @@ class TestStockEntry(unittest.TestCase):
|
||||
"stock_in_hand_account")
|
||||
|
||||
self.check_stock_ledger_entries("Stock Entry", mr.doc.name,
|
||||
[["_Test Item", "_Test Warehouse", 50.0]])
|
||||
[["_Test Item", "_Test Warehouse - _TC", 50.0]])
|
||||
|
||||
self.check_gl_entries("Stock Entry", mr.doc.name,
|
||||
sorted([
|
||||
@@ -66,8 +66,8 @@ class TestStockEntry(unittest.TestCase):
|
||||
|
||||
mr.cancel()
|
||||
self.check_stock_ledger_entries("Stock Entry", mr.doc.name,
|
||||
sorted([["_Test Item", "_Test Warehouse", 50.0],
|
||||
["_Test Item", "_Test Warehouse", -50.0]]))
|
||||
sorted([["_Test Item", "_Test Warehouse - _TC", 50.0],
|
||||
["_Test Item", "_Test Warehouse - _TC", -50.0]]))
|
||||
|
||||
self.check_gl_entries("Stock Entry", mr.doc.name,
|
||||
sorted([
|
||||
@@ -94,7 +94,7 @@ class TestStockEntry(unittest.TestCase):
|
||||
"stock_in_hand_account")
|
||||
|
||||
self.check_stock_ledger_entries("Stock Entry", mi.doc.name,
|
||||
[["_Test Item", "_Test Warehouse", -40.0]])
|
||||
[["_Test Item", "_Test Warehouse - _TC", -40.0]])
|
||||
|
||||
self.check_gl_entries("Stock Entry", mi.doc.name,
|
||||
sorted([
|
||||
@@ -106,8 +106,8 @@ class TestStockEntry(unittest.TestCase):
|
||||
mi.cancel()
|
||||
|
||||
self.check_stock_ledger_entries("Stock Entry", mi.doc.name,
|
||||
sorted([["_Test Item", "_Test Warehouse", -40.0],
|
||||
["_Test Item", "_Test Warehouse", 40.0]]))
|
||||
sorted([["_Test Item", "_Test Warehouse - _TC", -40.0],
|
||||
["_Test Item", "_Test Warehouse - _TC", 40.0]]))
|
||||
|
||||
self.check_gl_entries("Stock Entry", mi.doc.name,
|
||||
sorted([
|
||||
@@ -131,7 +131,7 @@ class TestStockEntry(unittest.TestCase):
|
||||
mtn.submit()
|
||||
|
||||
self.check_stock_ledger_entries("Stock Entry", mtn.doc.name,
|
||||
[["_Test Item", "_Test Warehouse", -45.0], ["_Test Item", "_Test Warehouse 1", 45.0]])
|
||||
[["_Test Item", "_Test Warehouse - _TC", -45.0], ["_Test Item", "_Test Warehouse 1 - _TC", 45.0]])
|
||||
|
||||
# no gl entry
|
||||
gl_entries = webnotes.conn.sql("""select * from `tabGL Entry`
|
||||
@@ -140,10 +140,10 @@ class TestStockEntry(unittest.TestCase):
|
||||
|
||||
mtn.cancel()
|
||||
self.check_stock_ledger_entries("Stock Entry", mtn.doc.name,
|
||||
sorted([["_Test Item", "_Test Warehouse", 45.0],
|
||||
["_Test Item", "_Test Warehouse 1", -45.0],
|
||||
["_Test Item", "_Test Warehouse", -45.0],
|
||||
["_Test Item", "_Test Warehouse 1", 45.0]]))
|
||||
sorted([["_Test Item", "_Test Warehouse - _TC", 45.0],
|
||||
["_Test Item", "_Test Warehouse 1 - _TC", -45.0],
|
||||
["_Test Item", "_Test Warehouse - _TC", -45.0],
|
||||
["_Test Item", "_Test Warehouse 1 - _TC", 45.0]]))
|
||||
|
||||
# no gl entry
|
||||
gl_entries = webnotes.conn.sql("""select * from `tabGL Entry`
|
||||
@@ -196,7 +196,7 @@ class TestStockEntry(unittest.TestCase):
|
||||
|
||||
def _get_actual_qty(self):
|
||||
return flt(webnotes.conn.get_value("Bin", {"item_code": "_Test Item",
|
||||
"warehouse": "_Test Warehouse"}, "actual_qty"))
|
||||
"warehouse": "_Test Warehouse - _TC"}, "actual_qty"))
|
||||
|
||||
def _test_sales_invoice_return(self, item_code, delivered_qty, returned_qty):
|
||||
from stock.doctype.stock_entry.stock_entry import NotUpdateStockError
|
||||
@@ -224,7 +224,7 @@ class TestStockEntry(unittest.TestCase):
|
||||
# insert a pos invoice with update stock
|
||||
si = webnotes.bean(copy=sales_invoice_test_records[1])
|
||||
si.doc.is_pos = si.doc.update_stock = 1
|
||||
si.doclist[1].warehouse = "_Test Warehouse"
|
||||
si.doclist[1].warehouse = "_Test Warehouse - _TC"
|
||||
si.doclist[1].item_code = item_code
|
||||
si.doclist[1].qty = 5.0
|
||||
si.insert()
|
||||
@@ -456,7 +456,7 @@ class TestStockEntry(unittest.TestCase):
|
||||
se.doc.posting_date = "2013-03-01"
|
||||
se.doc.fiscal_year = "_Test Fiscal Year 2013"
|
||||
se.doclist[1].qty = se.doclist[1].transfer_qty = 5
|
||||
se.doclist[1].s_warehouse = "_Test Warehouse"
|
||||
se.doclist[1].s_warehouse = "_Test Warehouse - _TC"
|
||||
se.insert()
|
||||
se.submit()
|
||||
|
||||
@@ -481,7 +481,7 @@ class TestStockEntry(unittest.TestCase):
|
||||
se.doc.posting_date = "2013-03-01"
|
||||
se.doc.fiscal_year = "_Test Fiscal Year 2013"
|
||||
se.doclist[1].qty = se.doclist[1].transfer_qty = 6
|
||||
se.doclist[1].s_warehouse = "_Test Warehouse"
|
||||
se.doclist[1].s_warehouse = "_Test Warehouse - _TC"
|
||||
|
||||
self.assertRaises(StockOverReturnError, se.insert)
|
||||
|
||||
@@ -556,7 +556,7 @@ class TestStockEntry(unittest.TestCase):
|
||||
se.doc.posting_date = "2013-03-01"
|
||||
se.doc.fiscal_year = "_Test Fiscal Year 2013"
|
||||
se.doclist[1].qty = se.doclist[1].transfer_qty = 5
|
||||
se.doclist[1].s_warehouse = "_Test Warehouse"
|
||||
se.doclist[1].s_warehouse = "_Test Warehouse - _TC"
|
||||
se.insert()
|
||||
se.submit()
|
||||
|
||||
@@ -589,7 +589,7 @@ test_records = [
|
||||
"stock_uom": "_Test UOM",
|
||||
"transfer_qty": 50.0,
|
||||
"uom": "_Test UOM",
|
||||
"t_warehouse": "_Test Warehouse",
|
||||
"t_warehouse": "_Test Warehouse - _TC",
|
||||
},
|
||||
],
|
||||
[
|
||||
@@ -612,7 +612,7 @@ test_records = [
|
||||
"stock_uom": "_Test UOM",
|
||||
"transfer_qty": 40.0,
|
||||
"uom": "_Test UOM",
|
||||
"s_warehouse": "_Test Warehouse",
|
||||
"s_warehouse": "_Test Warehouse - _TC",
|
||||
},
|
||||
],
|
||||
[
|
||||
@@ -635,8 +635,8 @@ test_records = [
|
||||
"stock_uom": "_Test UOM",
|
||||
"transfer_qty": 45.0,
|
||||
"uom": "_Test UOM",
|
||||
"s_warehouse": "_Test Warehouse",
|
||||
"t_warehouse": "_Test Warehouse 1",
|
||||
"s_warehouse": "_Test Warehouse - _TC",
|
||||
"t_warehouse": "_Test Warehouse 1 - _TC",
|
||||
}
|
||||
]
|
||||
]
|
||||
@@ -34,14 +34,14 @@ class TestStockReconciliation(unittest.TestCase):
|
||||
|
||||
# check stock value
|
||||
res = webnotes.conn.sql("""select stock_value from `tabStock Ledger Entry`
|
||||
where item_code = '_Test Item' and warehouse = '_Test Warehouse'
|
||||
where item_code = '_Test Item' and warehouse = '_Test Warehouse - _TC'
|
||||
and posting_date = %s and posting_time = %s order by name desc limit 1""",
|
||||
(d[2], d[3]))
|
||||
self.assertEqual(res and flt(res[0][0]) or 0, d[4])
|
||||
|
||||
# check bin qty and stock value
|
||||
bin = webnotes.conn.sql("""select actual_qty, stock_value from `tabBin`
|
||||
where item_code = '_Test Item' and warehouse = '_Test Warehouse'""")
|
||||
where item_code = '_Test Item' and warehouse = '_Test Warehouse - _TC'""")
|
||||
|
||||
self.assertEqual(bin and [flt(bin[0][0]), flt(bin[0][1])] or [], [d[5], d[6]])
|
||||
|
||||
@@ -79,7 +79,7 @@ class TestStockReconciliation(unittest.TestCase):
|
||||
|
||||
# check stock value in sle
|
||||
res = webnotes.conn.sql("""select stock_value from `tabStock Ledger Entry`
|
||||
where item_code = '_Test Item' and warehouse = '_Test Warehouse'
|
||||
where item_code = '_Test Item' and warehouse = '_Test Warehouse - _TC'
|
||||
and posting_date = %s and posting_time = %s order by name desc limit 1""",
|
||||
(d[2], d[3]))
|
||||
|
||||
@@ -87,7 +87,7 @@ class TestStockReconciliation(unittest.TestCase):
|
||||
|
||||
# bin qty and stock value
|
||||
bin = webnotes.conn.sql("""select actual_qty, stock_value from `tabBin`
|
||||
where item_code = '_Test Item' and warehouse = '_Test Warehouse'""")
|
||||
where item_code = '_Test Item' and warehouse = '_Test Warehouse - _TC'""")
|
||||
|
||||
self.assertEqual(bin and [flt(bin[0][0]), flt(bin[0][1], 4)] or [],
|
||||
[flt(d[5]), flt(d[6])])
|
||||
@@ -183,7 +183,7 @@ class TestStockReconciliation(unittest.TestCase):
|
||||
"expense_account": "Stock Adjustment - _TC",
|
||||
"reconciliation_json": json.dumps([
|
||||
["Item Code", "Warehouse", "Quantity", "Valuation Rate"],
|
||||
["_Test Item", "_Test Warehouse", qty, rate]
|
||||
["_Test Item", "_Test Warehouse - _TC", qty, rate]
|
||||
]),
|
||||
}])
|
||||
stock_reco.insert()
|
||||
@@ -226,7 +226,7 @@ class TestStockReconciliation(unittest.TestCase):
|
||||
{
|
||||
"doctype": "Stock Ledger Entry", "__islocal": 1,
|
||||
"voucher_type": "Stock Entry", "voucher_no": "TEST",
|
||||
"item_code": "_Test Item", "warehouse": "_Test Warehouse",
|
||||
"item_code": "_Test Item", "warehouse": "_Test Warehouse - _TC",
|
||||
"posting_date": "2012-12-12", "posting_time": "01:00",
|
||||
"actual_qty": 20, "incoming_rate": 1000, "company": "_Test Company",
|
||||
"fiscal_year": "_Test Fiscal Year 2012",
|
||||
@@ -234,7 +234,7 @@ class TestStockReconciliation(unittest.TestCase):
|
||||
{
|
||||
"doctype": "Stock Ledger Entry", "__islocal": 1,
|
||||
"voucher_type": "Stock Entry", "voucher_no": "TEST",
|
||||
"item_code": "_Test Item", "warehouse": "_Test Warehouse",
|
||||
"item_code": "_Test Item", "warehouse": "_Test Warehouse - _TC",
|
||||
"posting_date": "2012-12-15", "posting_time": "02:00",
|
||||
"actual_qty": 10, "incoming_rate": 700, "company": "_Test Company",
|
||||
"fiscal_year": "_Test Fiscal Year 2012",
|
||||
@@ -242,7 +242,7 @@ class TestStockReconciliation(unittest.TestCase):
|
||||
{
|
||||
"doctype": "Stock Ledger Entry", "__islocal": 1,
|
||||
"voucher_type": "Stock Entry", "voucher_no": "TEST",
|
||||
"item_code": "_Test Item", "warehouse": "_Test Warehouse",
|
||||
"item_code": "_Test Item", "warehouse": "_Test Warehouse - _TC",
|
||||
"posting_date": "2012-12-25", "posting_time": "03:00",
|
||||
"actual_qty": -15, "company": "_Test Company",
|
||||
"fiscal_year": "_Test Fiscal Year 2012",
|
||||
@@ -250,7 +250,7 @@ class TestStockReconciliation(unittest.TestCase):
|
||||
{
|
||||
"doctype": "Stock Ledger Entry", "__islocal": 1,
|
||||
"voucher_type": "Stock Entry", "voucher_no": "TEST",
|
||||
"item_code": "_Test Item", "warehouse": "_Test Warehouse",
|
||||
"item_code": "_Test Item", "warehouse": "_Test Warehouse - _TC",
|
||||
"posting_date": "2012-12-31", "posting_time": "08:00",
|
||||
"actual_qty": -20, "company": "_Test Company",
|
||||
"fiscal_year": "_Test Fiscal Year 2012",
|
||||
@@ -258,7 +258,7 @@ class TestStockReconciliation(unittest.TestCase):
|
||||
{
|
||||
"doctype": "Stock Ledger Entry", "__islocal": 1,
|
||||
"voucher_type": "Stock Entry", "voucher_no": "TEST",
|
||||
"item_code": "_Test Item", "warehouse": "_Test Warehouse",
|
||||
"item_code": "_Test Item", "warehouse": "_Test Warehouse - _TC",
|
||||
"posting_date": "2013-01-05", "posting_time": "07:00",
|
||||
"actual_qty": 15, "incoming_rate": 1200, "company": "_Test Company",
|
||||
"fiscal_year": "_Test Fiscal Year 2013",
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
from __future__ import unicode_literals
|
||||
import webnotes
|
||||
|
||||
from webnotes.utils import cstr, flt, validate_email_add
|
||||
from webnotes.utils import flt, validate_email_add
|
||||
from webnotes.model.code import get_obj
|
||||
from webnotes import msgprint
|
||||
|
||||
|
||||
Reference in New Issue
Block a user