Mobile app JavaScript
Odoo v10 introduced the Odoo mobile application. It provides a few small utilities to perform mobile actions, such as vibrating the phone, showing a toast message, and scanning QR codes.
Getting ready
We will be using the my_hostel
module from the previous recipe. We will show you the toast when we change the value of the color field from the mobile app.
Warning
The Odoo mobile app only supports the Enterprise Edition, so if you don’t have the Enterprise Edition, then you cannot test it.
How to do it…
Follow these steps to show a toast message in the Odoo mobile app:
import mobile from "@web_mobile/js/services/core"; clickPill(value) { Â Â Â Â if (mobile.methods.showToast) { Â Â Â Â Â Â mobile.methods.showToast({ 'message': 'Color changed' }); Â Â Â Â } Â Â Â Â this.props.record.update({ [this.props.name]: value }); Â Â ...