The website designer offers building blocks in website edit mode which can be dragged on the page. This recipe discusses how to offer your own blocks, called snippets, internally.
As we make use of the
library.book model, get chapter 4's code for
my_module. For convenience, this recipe's code contains a copy of it.
A snippet is actually just a QWeb view that gets injected in the Insert blocks bar, which is defined by a QWeb view itself:
<?xml version="1.0" encoding="UTF-8"?> <odoo> <template id="book_snippet" inherit_id="website.snippets"> <!-- points 2, 3 go here /--> </template> </odoo>
<xpath expr="//div[@id='snippet_feature']/div[@class='o_panel_body']" ...