fix(Vehicle): allow doc renaming and add test (#41729)

fix(Vehicle): allow renaming doc and add test
This commit is contained in:
Viny Selopal
2024-06-04 21:55:27 +05:30
committed by GitHub
parent 689e1cfc23
commit c76f466528
2 changed files with 28 additions and 1 deletions

View File

@@ -26,3 +26,29 @@ class TestVehicle(unittest.TestCase):
}
)
vehicle.insert()
def test_renaming_vehicle(self):
license_plate = random_string(10).upper()
vehicle = frappe.get_doc(
{
"doctype": "Vehicle",
"license_plate": license_plate,
"make": "Skoda",
"model": "Slavia",
"last_odometer": 5000,
"acquisition_date": frappe.utils.nowdate(),
"location": "Mumbai",
"chassis_no": "1234EFGH",
"uom": "Litre",
"vehicle_value": frappe.utils.flt(500000),
}
)
vehicle.insert()
new_license_plate = random_string(10).upper()
frappe.rename_doc("Vehicle", license_plate, new_license_plate)
self.assertEqual(
new_license_plate, frappe.db.get_value("Vehicle", new_license_plate, "license_plate")
)

View File

@@ -1,5 +1,6 @@
{
"actions": [],
"allow_rename": 1,
"autoname": "field:license_plate",
"creation": "2016-09-03 03:33:27.680331",
"doctype": "DocType",
@@ -195,7 +196,7 @@
}
],
"links": [],
"modified": "2024-03-27 13:10:58.133410",
"modified": "2024-05-31 06:38:15.399283",
"modified_by": "Administrator",
"module": "Setup",
"name": "Vehicle",