summaryrefslogtreecommitdiff
path: root/addons/pos_epson_printer_restaurant/static/src/js/multiprint.js
blob: 93806e98372167f5b3331a0459ae329d6b72bcd1 (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
odoo.define('pos_epson_printer_restaurant.multiprint', function (require) {
"use strict";

var models = require('point_of_sale.models');
var EpsonPrinter = require('pos_epson_printer.Printer');

// The override of create_printer needs to happen after its declaration in
// pos_restaurant. We need to make sure that this code is executed after the
// multiprint file in pos_restaurant.
require('pos_restaurant.multiprint');

models.load_fields("restaurant.printer", ["epson_printer_ip"]);

var _super_posmodel = models.PosModel.prototype;

models.PosModel = models.PosModel.extend({
    create_printer: function (config) {
        if (config.printer_type === "epson_epos") {
            return new EpsonPrinter(config.epson_printer_ip , posmodel);
        } else {
            return _super_posmodel.create_printer.apply(this, arguments);
        }
    },
});
});