mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-01 19:29:10 +00:00
refactor(test): move location creation to bootstrap in asset movement
(cherry picked from commit fd2b76a4d2)
This commit is contained in:
@@ -16,7 +16,6 @@ class TestAssetMovement(ERPNextTestSuite):
|
|||||||
frappe.db.set_value(
|
frappe.db.set_value(
|
||||||
"Company", "_Test Company", "capital_work_in_progress_account", "CWIP Account - _TC"
|
"Company", "_Test Company", "capital_work_in_progress_account", "CWIP Account - _TC"
|
||||||
)
|
)
|
||||||
make_location()
|
|
||||||
|
|
||||||
def test_movement(self):
|
def test_movement(self):
|
||||||
pr = make_purchase_receipt(item_code="Macbook Pro", qty=1, rate=100000.0, location="Test Location")
|
pr = make_purchase_receipt(item_code="Macbook Pro", qty=1, rate=100000.0, location="Test Location")
|
||||||
@@ -40,10 +39,6 @@ class TestAssetMovement(ERPNextTestSuite):
|
|||||||
if asset.docstatus == 0:
|
if asset.docstatus == 0:
|
||||||
asset.submit()
|
asset.submit()
|
||||||
|
|
||||||
# check asset movement is created
|
|
||||||
if not frappe.db.exists("Location", "Test Location 2"):
|
|
||||||
frappe.get_doc({"doctype": "Location", "location_name": "Test Location 2"}).insert()
|
|
||||||
|
|
||||||
create_asset_movement(
|
create_asset_movement(
|
||||||
purpose="Transfer",
|
purpose="Transfer",
|
||||||
company=asset.company,
|
company=asset.company,
|
||||||
@@ -122,9 +117,6 @@ class TestAssetMovement(ERPNextTestSuite):
|
|||||||
if asset.docstatus == 0:
|
if asset.docstatus == 0:
|
||||||
asset.submit()
|
asset.submit()
|
||||||
|
|
||||||
if not frappe.db.exists("Location", "Test Location 2"):
|
|
||||||
frappe.get_doc({"doctype": "Location", "location_name": "Test Location 2"}).insert()
|
|
||||||
|
|
||||||
movement = frappe.get_doc({"doctype": "Asset Movement", "reference_name": pr.name})
|
movement = frappe.get_doc({"doctype": "Asset Movement", "reference_name": pr.name})
|
||||||
self.assertRaises(frappe.ValidationError, movement.cancel)
|
self.assertRaises(frappe.ValidationError, movement.cancel)
|
||||||
|
|
||||||
@@ -150,9 +142,6 @@ class TestAssetMovement(ERPNextTestSuite):
|
|||||||
asset = create_asset(item_code="Macbook Pro", do_not_save=1)
|
asset = create_asset(item_code="Macbook Pro", do_not_save=1)
|
||||||
asset.save().submit()
|
asset.save().submit()
|
||||||
|
|
||||||
if not frappe.db.exists("Location", "Test Location 2"):
|
|
||||||
frappe.get_doc({"doctype": "Location", "location_name": "Test Location 2"}).insert()
|
|
||||||
|
|
||||||
asset_creation_date = frappe.db.get_value(
|
asset_creation_date = frappe.db.get_value(
|
||||||
"Asset Movement",
|
"Asset Movement",
|
||||||
[["Asset Movement Item", "asset", "=", asset.name], ["docstatus", "=", 1]],
|
[["Asset Movement Item", "asset", "=", asset.name], ["docstatus", "=", 1]],
|
||||||
@@ -197,9 +186,3 @@ def create_asset_movement(**args):
|
|||||||
movement.submit()
|
movement.submit()
|
||||||
|
|
||||||
return movement
|
return movement
|
||||||
|
|
||||||
|
|
||||||
def make_location():
|
|
||||||
for location in ["Pune", "Mumbai", "Nagpur"]:
|
|
||||||
if not frappe.db.exists("Location", location):
|
|
||||||
frappe.get_doc({"doctype": "Location", "location_name": location}).insert(ignore_permissions=True)
|
|
||||||
|
|||||||
@@ -975,6 +975,7 @@ class BootStrapTestData:
|
|||||||
def make_location(self):
|
def make_location(self):
|
||||||
records = [
|
records = [
|
||||||
{"doctype": "Location", "location_name": "Test Location"},
|
{"doctype": "Location", "location_name": "Test Location"},
|
||||||
|
{"doctype": "Location", "location_name": "Test Location 2"},
|
||||||
{"doctype": "Location", "location_name": "Test Location Area", "is_group": 1, "is_container": 1},
|
{"doctype": "Location", "location_name": "Test Location Area", "is_group": 1, "is_container": 1},
|
||||||
{
|
{
|
||||||
"doctype": "Location",
|
"doctype": "Location",
|
||||||
|
|||||||
Reference in New Issue
Block a user