Creating button to (un)publish content and navigate between the backend and frontend

< / / / / / >
Intermediate
Framework Website
V12.0
V 12.0
+/- 14 minutes
Written by Yenthe Van Ginneken
(0)

Quick scroll

1. Introduction

When you have online content on your website you usually want to be able to show or hide it at some point in time. If you're still in the process of writing the text for your content or if your content is outdated you'll want an option to quickly hide it on your website. While you're editing content or going through your content most of the time you'll want to check the content both in the backend and on the website. Thanks to Odoo there is an option to do both by inheriting the existing model 'website.published.mixin' and using these fields to create a smart button to quickly switch between the backend and frontend.

In this tutorial we will create a new model named 'tutorial' and website pages for all tutorial records. We'll add a smart button on the form to publish or unpublish records on the website. The smart button will also allow us to quickly open the related website page and to get back to the backend from the frontend.

This tutorial is exclusive for premium members
Become a member too and read all tutorials, unlimited.

Already a member? login here.