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

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

fix(Vehicle): allow renaming doc and add test

(cherry picked from commit c76f466528)

# Conflicts:
#	erpnext/setup/doctype/vehicle/vehicle.json

* fix: resolve conflicts for backporting

---------

Co-authored-by: Viny Selopal <52369157+vinyselopal@users.noreply.github.com>
Co-authored-by: Viny Selopal <viny0698@gmail.com>
This commit is contained in:
mergify[bot]
2024-06-07 15:45:50 +05:30
committed by GitHub
parent 4d3e883130
commit 4d37739dd3
2 changed files with 30 additions and 2 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

@@ -2,7 +2,8 @@
"allow_copy": 0,
"allow_guest_to_view": 0,
"allow_import": 0,
"allow_rename": 0,
"actions": [],
"allow_rename": 1,
"autoname": "field:license_plate",
"beta": 0,
"creation": "2016-09-03 03:33:27.680331",
@@ -834,7 +835,8 @@
"issingle": 0,
"istable": 0,
"max_attachments": 0,
"modified": "2022-06-27 14:48:30.813359",
"links": [],
"modified": "2024-05-31 06:38:15.399283",
"modified_by": "Administrator",
"module": "Setup",
"name": "Vehicle",