Merge pull request #29964 from marination/fox-flaky-stock-reports-test
chore: Rollback after each test, due to premature commit via `remove_user_permission`
This commit is contained in:
commit
8b1ef7bcc6
@ -44,6 +44,7 @@ def get_sle(**args):
|
|||||||
|
|
||||||
class TestStockEntry(ERPNextTestCase):
|
class TestStockEntry(ERPNextTestCase):
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
|
frappe.db.rollback()
|
||||||
frappe.set_user("Administrator")
|
frappe.set_user("Administrator")
|
||||||
frappe.db.set_value("Manufacturing Settings", None, "material_consumption", "0")
|
frappe.db.set_value("Manufacturing Settings", None, "material_consumption", "0")
|
||||||
|
|
||||||
@ -565,6 +566,7 @@ class TestStockEntry(ERPNextTestCase):
|
|||||||
st1.set_stock_entry_type()
|
st1.set_stock_entry_type()
|
||||||
st1.insert()
|
st1.insert()
|
||||||
st1.submit()
|
st1.submit()
|
||||||
|
st1.cancel()
|
||||||
|
|
||||||
frappe.set_user("Administrator")
|
frappe.set_user("Administrator")
|
||||||
remove_user_permission("Warehouse", "_Test Warehouse 1 - _TC", "test@example.com")
|
remove_user_permission("Warehouse", "_Test Warehouse 1 - _TC", "test@example.com")
|
||||||
@ -689,6 +691,8 @@ class TestStockEntry(ERPNextTestCase):
|
|||||||
bom_no = frappe.db.get_value("BOM", {"item": "_Test Variant Item",
|
bom_no = frappe.db.get_value("BOM", {"item": "_Test Variant Item",
|
||||||
"is_default": 1, "docstatus": 1})
|
"is_default": 1, "docstatus": 1})
|
||||||
|
|
||||||
|
make_item_variant() # make variant of _Test Variant Item if absent
|
||||||
|
|
||||||
work_order = frappe.new_doc("Work Order")
|
work_order = frappe.new_doc("Work Order")
|
||||||
work_order.update({
|
work_order.update({
|
||||||
"company": "_Test Company",
|
"company": "_Test Company",
|
||||||
@ -1023,13 +1027,10 @@ class TestStockEntry(ERPNextTestCase):
|
|||||||
|
|
||||||
# Check if FG cost is calculated based on RM total cost
|
# Check if FG cost is calculated based on RM total cost
|
||||||
# RM total cost = 200, FG rate = 200/4(FG qty) = 50
|
# RM total cost = 200, FG rate = 200/4(FG qty) = 50
|
||||||
self.assertEqual(se.items[1].basic_rate, 50)
|
self.assertEqual(se.items[1].basic_rate, flt(se.items[0].basic_rate/4))
|
||||||
self.assertEqual(se.value_difference, 0.0)
|
self.assertEqual(se.value_difference, 0.0)
|
||||||
self.assertEqual(se.total_incoming_value, se.total_outgoing_value)
|
self.assertEqual(se.total_incoming_value, se.total_outgoing_value)
|
||||||
|
|
||||||
# teardown
|
|
||||||
se.delete()
|
|
||||||
|
|
||||||
@change_settings("Stock Settings", {"allow_negative_stock": 0})
|
@change_settings("Stock Settings", {"allow_negative_stock": 0})
|
||||||
def test_future_negative_sle(self):
|
def test_future_negative_sle(self):
|
||||||
# Initialize item, batch, warehouse, opening qty
|
# Initialize item, batch, warehouse, opening qty
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user