How to do it...

Follow these steps to show toast in the Odoo mobile app:

  1. Import web_mobile.rpc in field_widget.js:
var mobile = require('web_mobile.rpc');
  1. Modify the clickPill method to display toast when user changes color from mobile device:
    clickPill: function (ev) {
var $target = $(ev.currentTarget);
var data = $target.data();
if (mobile.methods.showToast) {
mobile.methods.showToast({ 'message': 'Color changed' });
}
this._setValue(data.val.toString());
}

Update the module and open the form view of the library.book model in the mobile app. When you change the color, you will see toast, as shown in the following screenshot:

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset