diff --git a/frappe/client.py b/frappe/client.py index bec3aefb7b..f42f73a529 100644 --- a/frappe/client.py +++ b/frappe/client.py @@ -206,9 +206,9 @@ def insert_many(docs=None): if len(docs) > 200: frappe.throw(_("Only 200 inserts allowed in one request")) - out = set() + out = [] for doc in docs: - out.add(insert_doc(doc).name) + out.append(insert_doc(doc).name) return out diff --git a/frappe/tests/test_client.py b/frappe/tests/test_client.py index bd80e7d5f3..485c023bc4 100644 --- a/frappe/tests/test_client.py +++ b/frappe/tests/test_client.py @@ -227,15 +227,18 @@ class TestClient(FrappeTestCase): "parent": note1.name, "parentfield": "seen_by", }, + {"doctype": "Note", "title": "not-a-random-title", "content": "test"}, {"doctype": "Note", "title": get_random_title(), "content": "test"}, {"doctype": "Note", "title": get_random_title(), "content": "test"}, + {"doctype": "Note", "title": "another-note-title", "content": "test"}, ] # insert all docs docs = insert_many(doc_list) - # make sure only 1 name is returned for the parent upon insertion of child docs - self.assertEqual(len(docs), 3) + self.assertEqual(len(docs), 7) + self.assertEqual(docs[3], "not-a-random-title") + self.assertEqual(docs[6], "another-note-title") self.assertIn(note1.name, docs) # cleanup