summaryrefslogtreecommitdiff
path: root/addons/pos_mercury/static/src/js/ProductScreen.js
blob: 64d53048e63cee90e1bb0932472bb1c77a1860fc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
odoo.define('pos_mercury.ProductScreen', function (require) {
    'use strict';

    const ProductScreen = require('point_of_sale.ProductScreen');
    const Registries = require('point_of_sale.Registries');
    const { useBarcodeReader } = require('point_of_sale.custom_hooks');

    const PosMercuryProductScreen = (ProductScreen) =>
        class extends ProductScreen {
            constructor() {
                super(...arguments);
                useBarcodeReader({
                    credit: this.credit_error_action,
                });
            }
            credit_error_action() {
                this.showPopup('ErrorPopup', {
                    body: this.env._t('Go to payment screen to use cards'),
                });
            }
        };

    Registries.Component.extend(ProductScreen, PosMercuryProductScreen);

    return ProductScreen;
});