In this recipe, we will add some categories from the XML file and then delete them. In real situations, you will create this record from another module. But for simplicity, we will just add some categories in the same XML file, as follows:
<record id="book_category_to_delete" model="library.book.category">
<field name="name">Test Category</field>
</record>
<record id="book_category_not_delete" model="library.book.category">
<field name="name">Test Category 2</field>
</record>