Creation of Custom Pop-UpsΒΆ

Use the Custom Pop-Ups to provide information or to prompt Users to do something in POS. You can define the appearance of a pop-up.

Let take the example of the creation a pop-up of QR Code Scanning in POS module , where we needed to create a pop-up to show the video from camera to scan QR codes.

First, attach necessary requirements:

var PopupWidget = require('point_of_sale.popups');

Then, create a new instance, the new default pop-up extension:

var QrScanPopupWidget = PopupWidget.extend({
// It requires the template attribute with a Qweb template name for showing pop-up
template: 'QrScanPopupWidget',

To make the pop-up be reachable with regular methods after the QrScanPopupWidget declaration do the following:

gui.define_popup({name:'qr_scan', widget: QrScanPopupWidget});

so it can be called with the next code:

this.gui.show_popup('qr_scan',{
  'title': 'QR Scanning',
  'value': false,
});