mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-26 08:24:47 +00:00
fix(Vehicle): allow doc renaming and add test (#41729)
fix(Vehicle): allow renaming doc and add test
This commit is contained in:
@@ -26,3 +26,29 @@ class TestVehicle(unittest.TestCase):
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
vehicle.insert()
|
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")
|
||||||
|
)
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
{
|
{
|
||||||
"actions": [],
|
"actions": [],
|
||||||
|
"allow_rename": 1,
|
||||||
"autoname": "field:license_plate",
|
"autoname": "field:license_plate",
|
||||||
"creation": "2016-09-03 03:33:27.680331",
|
"creation": "2016-09-03 03:33:27.680331",
|
||||||
"doctype": "DocType",
|
"doctype": "DocType",
|
||||||
@@ -195,7 +196,7 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"links": [],
|
"links": [],
|
||||||
"modified": "2024-03-27 13:10:58.133410",
|
"modified": "2024-05-31 06:38:15.399283",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Setup",
|
"module": "Setup",
|
||||||
"name": "Vehicle",
|
"name": "Vehicle",
|
||||||
|
|||||||
Reference in New Issue
Block a user