diff --git a/erpnext/agriculture/doctype/crop_cycle/test_records.json b/erpnext/agriculture/doctype/crop_cycle/test_records.json index fade7a0f9e..5c79f1030a 100644 --- a/erpnext/agriculture/doctype/crop_cycle/test_records.json +++ b/erpnext/agriculture/doctype/crop_cycle/test_records.json @@ -2,8 +2,8 @@ { "doctype": "Crop Cycle", "title": "Basil from seed 2017", - "linked_land_unit": [{ - "land_unit": "Basil Farm" + "linked_location": [{ + "location": "Basil Farm" }], "crop": "Basil from seed", "start_date": "2017-11-11", diff --git a/erpnext/assets/doctype/location/test_location.py b/erpnext/assets/doctype/location/test_location.py index 6d8dd69cb8..dcb700990f 100644 --- a/erpnext/assets/doctype/location/test_location.py +++ b/erpnext/assets/doctype/location/test_location.py @@ -8,6 +8,7 @@ import unittest import frappe +test_records = frappe.get_test_records('Location') class TestLocation(unittest.TestCase): def runTest(self): @@ -25,7 +26,7 @@ class TestLocation(unittest.TestCase): formatted_locations.extend(temp['features']) formatted_location_string = str(formatted_locations) - test_location = frappe.get_doc('Location', 'Test Location') + test_location = frappe.get_doc('Location', 'Test Location Area') self.assertEqual(formatted_location_string, str(json.loads(test_location.get('location'))['features'])) self.assertEqual(area, test_location.get('area')) diff --git a/erpnext/assets/doctype/location/test_records.json b/erpnext/assets/doctype/location/test_records.json index 3827225251..8a89cf8bdd 100644 --- a/erpnext/assets/doctype/location/test_records.json +++ b/erpnext/assets/doctype/location/test_records.json @@ -1,7 +1,7 @@ [ { "doctype": "Location", - "location_name": "Test Location", + "location_name": "Test Location Area", "is_group": 1, "is_container": 1 }, @@ -9,8 +9,8 @@ "doctype": "Location", "location_name": "Basil Farm", "location": "{\"type\":\"FeatureCollection\",\"features\":[{\"type\":\"Feature\",\"properties\":{\"point_type\":\"circle\",\"radius\":884.5625420736483},\"geometry\":{\"type\":\"Point\",\"coordinates\":[72.875834,19.100566]}}]}", - "parent_location": "Test Location", - "parent": "Test Location", + "parent_location": "Test Location Area", + "parent": "Test Location Area", "is_group": 1, "is_container": 1 }, diff --git a/erpnext/patches/v11_0/add_index_on_nestedset_doctypes.py b/erpnext/patches/v11_0/add_index_on_nestedset_doctypes.py index 0fdf0b989c..2a0c0519ee 100644 --- a/erpnext/patches/v11_0/add_index_on_nestedset_doctypes.py +++ b/erpnext/patches/v11_0/add_index_on_nestedset_doctypes.py @@ -4,7 +4,7 @@ import frappe def execute(): - frappe.reload_doc("agriculture", "doctype", "land_unit") - for dt in ("Account", "Cost Center", "File", "Employee", "Land Unit", "Task", "Customer Group", "Sales Person", "Territory"): + frappe.reload_doc("agriculture", "doctype", "Location") + for dt in ("Account", "Cost Center", "File", "Employee", "Location", "Task", "Customer Group", "Sales Person", "Territory"): frappe.reload_doctype(dt) frappe.get_doc("DocType", dt).run_module_method("on_doctype_update") \ No newline at end of file diff --git a/erpnext/patches/v11_0/merge_land_unit_with_location.py b/erpnext/patches/v11_0/merge_land_unit_with_location.py index 999fb1f18d..4ded98b5ca 100644 --- a/erpnext/patches/v11_0/merge_land_unit_with_location.py +++ b/erpnext/patches/v11_0/merge_land_unit_with_location.py @@ -20,6 +20,9 @@ def execute(): frappe.reload_doc('assets', 'doctype', 'linked_location') + if not frappe.db.table_exists('Crop Cycle'): + frappe.reload_doc('agriculture', 'doctype', 'crop_cycle') + # Rename the fields in related doctypes if 'linked_land_unit' in frappe.db.get_table_columns('Crop Cycle'): rename_field('Crop Cycle', 'linked_land_unit', 'linked_location')