Development Book V17: Mobile App Javascript

From Odoo Version 10 onwards, a mobile app is introduced to access all the Odoo apps , even the custom modules also.

import mobile from "@web_mobile/js/services/core";

if (mobile.methods.vibrate) {

In this code,
import mobile from "@web_mobile/js/services/core"; - Importing mobile object
if (mobile.methods.addHomeShortcut) { - Check service available
userMenuRegistry.add("web_mobile.shortcut", shortcutItem); - Execute method

web_mobile establishes the connection between your mobile device and Odoo Javascript. It provides a list of utilities. In the image above, we use the Vibrate method to constantly vibrate for a specified amount of time.

Mobile Utilities Example;

1. mobile.methods.showToast({'message': 'Message sent'});
In the example above, we used the showToast method to display a toast in our mobile app.

2. mobile.methods.showSnackBar({'message': 'Message is deleted', 'btn_text': 'Undo'})
Snackbars display short messages at the bottom of your mobile screen.

mobile.showNotification({'title': 'Simple Notification', 'message': 'This is a test for a simple notification'})
The ShowNotification method can be used to display notifications on the mobile app.

4.var contact = { 'name': 'Michel Fletcher', 'mobile': '9999999999', 'phone': '7954856587', 'fax': '765898745', 'email': '', 'website': '', 'street': '69 rue de Namur', 'street2': false, 'country_id': [21, 'Belgium'], 'state_id': false, 'city': 'Wavre', 'zip': '1300', 'parent_id': [8, 'Agrolait'], 'function': 'Analyst', 'image': '<< BASE 64 Image Data >>'}

addContact can be used to create a new contact on mobile.

scanBarcode method can be used to scan QR codes.

switchAccount method can be used to switch from one account to another on the device.



Cybrosys Technologies Pvt. Ltd.
Neospace, Kinfra Techno Park
Kakkancherry, Calicut
Kerala, India - 673635



Cybrosys Technologies Pvt. Ltd.
1st Floor, Thapasya Building,
Infopark, Kakkanad,
Kochi, India - 682030.



Cybrosys Techno Solutions
The Estate, 8th Floor,
Dickenson Road,
Bangalore, India - 560042

Send Us A Message