Начальное наполнение

This commit is contained in:
parent 116957ea21
commit b37b18beb5
7 changed files with 121 additions and 0 deletions

4
__init__.py Normal file
View File

@ -0,0 +1,4 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from . import models

23
__manifest__.py Normal file
View File

@ -0,0 +1,23 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
{
'name': 'POS Self Order Epson Printer',
'version': '1.0',
'category': 'Sales/Point of Sale',
'sequence': 6,
'summary': 'Epson ePOS Printers in PoS Kiosk',
'description': "Use Epson ePOS Printers without the IoT Box in the PoS Kiosk",
'depends': ['pos_epson_printer', 'pos_self_order'],
'installable': True,
'auto_install': True,
'assets': {
'pos_self_order.assets': [
'pos_epson_printer/static/src/app/epson_printer.js',
'pos_epson_printer/static/src/app/components/epos_templates.xml',
'pos_self_order_epson_printer/static/src/**/*',
],
},
'license': 'LGPL-3',
}

View File

@ -0,0 +1,21 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * pos_self_order_epson_printer
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 17.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-10-26 21:55+0000\n"
"PO-Revision-Date: 2023-10-26 21:55+0000\n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"
#. module: pos_self_order_epson_printer
#: model:ir.model,name:pos_self_order_epson_printer.model_pos_config
msgid "Point of Sale Configuration"
msgstr ""

23
i18n/ru.po Normal file
View File

@ -0,0 +1,23 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * pos_self_order_epson_printer
#
# Translators:
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 17.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-10-26 21:55+0000\n"
"PO-Revision-Date: 2024-01-30 15:14+0400\n"
"Last-Translator: \n"
"Language-Team: Russian (https://app.transifex.com/odoo/teams/41243/ru/)\n"
"Language: ru\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=4; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<12 || n%100>14) ? 1 : n%10==0 || (n%10>=5 && n%10<=9) || (n%100>=11 && n%100<=14)? 2 : 3);\n"
#. module: pos_self_order_epson_printer
#: model:ir.model,name:pos_self_order_epson_printer.model_pos_config
msgid "Point of Sale Configuration"
msgstr "Конфигурация точки продаж"

4
models/__init__.py Normal file
View File

@ -0,0 +1,4 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from . import pos_config

21
models/pos_config.py Normal file
View File

@ -0,0 +1,21 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import models
class PosConfig(models.Model):
_inherit = 'pos.config'
def _get_self_ordering_data(self):
data = super()._get_self_ordering_data()
data["config"]["epson_printer_ip"] = self.epson_printer_ip
data["config"]["other_devices"] = self.other_devices
return data
def _get_kitchen_printer(self):
res = super()._get_kitchen_printer()
for printer in self.printer_ids:
if printer.epson_printer_ip:
res[printer.id]["epson_printer_ip"] = printer.epson_printer_ip
return res

View File

@ -0,0 +1,25 @@
/** @odoo-module */
import { EpsonPrinter } from "@pos_epson_printer/app/epson_printer";
import { SelfOrder } from "@pos_self_order/app/self_order_service";
import { patch } from "@web/core/utils/patch";
patch(SelfOrder.prototype, {
async setup() {
await super.setup(...arguments);
if (!this.config.epson_printer_ip || !this.config.other_devices) {
return;
}
this.printer.setPrinter(
new EpsonPrinter({
ip: this.config.epson_printer_ip,
})
);
},
create_printer(printer) {
if (printer.printer_type === "epson_epos") {
return new EpsonPrinter({ ip: printer.epson_printer_ip });
}
return super.create_printer(...arguments);
},
});