Publish management for website-related records
In business flows, there are some cases where you need to allow or revoke page access to public users. One such case is e-commerce products, where you need to publish or unpublish products based on availability. In this recipe, we will see how you can publish and unpublish book records for public users.
For this recipe, we will be using the
my_library module from the previous recipe.
If you notice, we have put
auth='user' on the
/books/ <model("library.book"):book> routes. Please change this to
auth='public' to make those URLs accessible for public users.
How to do it…
Perform the following steps to enable a publish/unpublish option for book detail pages:
library.bookmodel like this:
class LibraryBook(models.Model): _name = 'library.book' ...