Chapter 9 - Odoo 15 Development Book

Mobile App Javascript

In Odoo 10, a mobile application was introduced which allows us to access all apps.

var mobile = required('');
if (mobile.methods.vibrate){
	mobile.methods.vibrate({'duration': 100})

The web_mobile.rpc provides the connection between the mobile devices and Odoo Javascript. The Mobile RPC provides a list of Utilities. In the above image, used vibrate method which constantly vibrates for the specified time.

Mobile Utilities Example;

1. mobile.methods.showToast({'message': 'Message sent'});

In the above example, we have used showToast method to display toast in the mobile app.

2. mobile.methods.showSnackBar({'message': 'Message is deleted', 'btn_text': 'Undo'})

Snackbars show a brief messages at the bottom of the mobile screen.

3. mobile.showNotification({'title': 'Simple Notification', 'message': 'This is a test for a simple notification'})

Show Notification show 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 in mobile.

5. mobile.methods.scanBarcode()

scanBarcode method can be used to scan QR codes.

6. mobile.methods.switchAccount();

switchAccount method is used to switch from one account to another.



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