Offering static snippets to the user
Odoo's website editor offers several editing building blocks, which can be dragged onto the page and edited according to your needs. This recipe will cover how to offer your own building blocks. These blocks are referred to as snippets. There are several types of snippets, but in general, we can categorize them into two types: static and dynamic. The static snippet is fixed and does not change until the user changes it. Dynamic snippets depend on database records and are changed based on record values. In this recipe, we will see how to create a static snippet.
For this recipe, we will be using the
my_library module from the previous recipe.
How to do it...
A snippet is actually just a QWeb view that gets injected into the Insert blocks bar. We will create a small snippet that will show the book's image and book title. You will be able to drag and drop the snippet on the page and you will be able to edit the image...