Mobile app javascript
From Odoo Version 10 onwards, a mobile app is introduced to access all the Odoo apps , even the custom modules also.
web_mobile.rpc establishes the connection between your mobile device and Odoo Javascript. Mobile RPC 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.
3. 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': 'michel.fletcher@agrolait.example.com',
'website': 'http://www.agrolait.com',
'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>>'}
mobile.methods.addContact(contact);
addContact can be used to create a new contact on mobile.
. mobile.methods.scanBarcode()
scanBarcode method can be used to scan QR codes.
mobile.methods.switchAccount();
switchAccount method can be used to switch from one account to another on the device.