[stock entry] [test] fixes in test cases
This commit is contained in:
parent
549dfdbfed
commit
0f5f584651
@ -157,7 +157,7 @@ class DocType(SellingController):
|
|||||||
# fetch pos details, if they are not fetched
|
# fetch pos details, if they are not fetched
|
||||||
if cint(self.doc.is_pos):
|
if cint(self.doc.is_pos):
|
||||||
self.set_pos_fields(for_validate=True)
|
self.set_pos_fields(for_validate=True)
|
||||||
|
|
||||||
def update_time_log_batch(self, sales_invoice):
|
def update_time_log_batch(self, sales_invoice):
|
||||||
for d in self.doclist.get({"doctype":"Sales Invoice Item"}):
|
for d in self.doclist.get({"doctype":"Sales Invoice Item"}):
|
||||||
if d.time_log_batch:
|
if d.time_log_batch:
|
||||||
|
@ -25,6 +25,8 @@ class TestStockEntry(unittest.TestCase):
|
|||||||
where item_code='_Test Item'""")
|
where item_code='_Test Item'""")
|
||||||
|
|
||||||
self.assertTrue(mr_name)
|
self.assertTrue(mr_name)
|
||||||
|
|
||||||
|
webnotes.conn.set_default("company", self.old_default_company)
|
||||||
|
|
||||||
def test_warehouse_company_validation(self):
|
def test_warehouse_company_validation(self):
|
||||||
from stock.doctype.stock_ledger_entry.stock_ledger_entry import InvalidWarehouseCompany
|
from stock.doctype.stock_ledger_entry.stock_ledger_entry import InvalidWarehouseCompany
|
||||||
@ -71,7 +73,7 @@ class TestStockEntry(unittest.TestCase):
|
|||||||
webnotes.defaults.set_global_default("auto_inventory_accounting", 0)
|
webnotes.defaults.set_global_default("auto_inventory_accounting", 0)
|
||||||
|
|
||||||
def test_material_issue_gl_entry(self):
|
def test_material_issue_gl_entry(self):
|
||||||
webnotes.conn.sql("delete from `tabStock Ledger Entry`")
|
self._clear_stock()
|
||||||
webnotes.defaults.set_global_default("auto_inventory_accounting", 1)
|
webnotes.defaults.set_global_default("auto_inventory_accounting", 1)
|
||||||
|
|
||||||
mr = webnotes.bean(copy=test_records[0])
|
mr = webnotes.bean(copy=test_records[0])
|
||||||
@ -111,9 +113,10 @@ class TestStockEntry(unittest.TestCase):
|
|||||||
)
|
)
|
||||||
|
|
||||||
webnotes.defaults.set_global_default("auto_inventory_accounting", 0)
|
webnotes.defaults.set_global_default("auto_inventory_accounting", 0)
|
||||||
|
webnotes.conn.set_default("company", self.old_default_company)
|
||||||
|
|
||||||
def test_material_transfer_gl_entry(self):
|
def test_material_transfer_gl_entry(self):
|
||||||
webnotes.conn.sql("delete from `tabStock Ledger Entry`")
|
self._clear_stock()
|
||||||
webnotes.defaults.set_global_default("auto_inventory_accounting", 1)
|
webnotes.defaults.set_global_default("auto_inventory_accounting", 1)
|
||||||
|
|
||||||
mr = webnotes.bean(copy=test_records[0])
|
mr = webnotes.bean(copy=test_records[0])
|
||||||
@ -145,6 +148,7 @@ class TestStockEntry(unittest.TestCase):
|
|||||||
self.assertFalse(gl_entries)
|
self.assertFalse(gl_entries)
|
||||||
|
|
||||||
webnotes.defaults.set_global_default("auto_inventory_accounting", 0)
|
webnotes.defaults.set_global_default("auto_inventory_accounting", 0)
|
||||||
|
webnotes.conn.set_default("company", self.old_default_company)
|
||||||
|
|
||||||
def check_stock_ledger_entries(self, voucher_type, voucher_no, expected_sle):
|
def check_stock_ledger_entries(self, voucher_type, voucher_no, expected_sle):
|
||||||
# check stock ledger entries
|
# check stock ledger entries
|
||||||
@ -173,6 +177,9 @@ class TestStockEntry(unittest.TestCase):
|
|||||||
def _clear_stock(self):
|
def _clear_stock(self):
|
||||||
webnotes.conn.sql("delete from `tabStock Ledger Entry`")
|
webnotes.conn.sql("delete from `tabStock Ledger Entry`")
|
||||||
webnotes.conn.sql("""delete from `tabBin`""")
|
webnotes.conn.sql("""delete from `tabBin`""")
|
||||||
|
|
||||||
|
self.old_default_company = webnotes.conn.get_default("company")
|
||||||
|
webnotes.conn.set_default("company", "_Test Company")
|
||||||
|
|
||||||
def _insert_material_receipt(self):
|
def _insert_material_receipt(self):
|
||||||
self._clear_stock()
|
self._clear_stock()
|
||||||
@ -185,6 +192,8 @@ class TestStockEntry(unittest.TestCase):
|
|||||||
se2.insert()
|
se2.insert()
|
||||||
se2.submit()
|
se2.submit()
|
||||||
|
|
||||||
|
webnotes.conn.set_default("company", self.old_default_company)
|
||||||
|
|
||||||
def _get_actual_qty(self):
|
def _get_actual_qty(self):
|
||||||
return flt(webnotes.conn.get_value("Bin", {"item_code": "_Test Item",
|
return flt(webnotes.conn.get_value("Bin", {"item_code": "_Test Item",
|
||||||
"warehouse": "_Test Warehouse"}, "actual_qty"))
|
"warehouse": "_Test Warehouse"}, "actual_qty"))
|
||||||
@ -463,6 +472,8 @@ class TestStockEntry(unittest.TestCase):
|
|||||||
|
|
||||||
self.assertEquals(actual_qty_1 - 5, actual_qty_2)
|
self.assertEquals(actual_qty_1 - 5, actual_qty_2)
|
||||||
|
|
||||||
|
webnotes.conn.set_default("company", self.old_default_company)
|
||||||
|
|
||||||
return se, pr.doc.name
|
return se, pr.doc.name
|
||||||
|
|
||||||
def test_over_stock_return(self):
|
def test_over_stock_return(self):
|
||||||
@ -563,6 +574,8 @@ class TestStockEntry(unittest.TestCase):
|
|||||||
|
|
||||||
self.assertEquals(actual_qty_1 - 5, actual_qty_2)
|
self.assertEquals(actual_qty_1 - 5, actual_qty_2)
|
||||||
|
|
||||||
|
webnotes.conn.set_default("company", self.old_default_company)
|
||||||
|
|
||||||
return se, pr.doc.name
|
return se, pr.doc.name
|
||||||
|
|
||||||
test_records = [
|
test_records = [
|
||||||
|
Loading…
Reference in New Issue
Block a user