Files
odoo_source/addons/pos_epson_printer/models/pos_printer.py
T
David Monnom (moda) 73aae73f1b [IMP] point_of_sale,*: move kitchen printer logic to point_of_sale
*:pos_epson_printer,pos_epson_printer_restaurant,point_of_sale,
pos_restaurant,pos_hr_restaurant

Before the printers only worked in the pos_restaurant and not in the
point_of_sale. Indeed, the methods managing the printers were located
in the pos_restaurant.

Now all these methods have been moved.
For the community part here are the affected modules:
- The methods in pos_epson_printer_restaurant have been moved to
pos_epson_printer.
- The methods in pos_restaurant have been moved to point_of_sale.
- The module pos_epson_printer_restaurant has been removed as it only
handled printers.

Some of these methods have been adapted/renamed to better suit
the needs.

This branch the first part of the following task: 3224508

closes odoo/odoo#114655

Related: odoo/upgrade#4414
Related: odoo/enterprise#37901
Signed-off-by: Joseph Caburnay (jcb) <jcb@odoo.com>
2023-05-03 12:39:17 +02:00

19 lines
766 B
Python

# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import fields, models, api, _
from odoo.exceptions import ValidationError
class PosPrinter(models.Model):
_inherit = 'pos.printer'
printer_type = fields.Selection(selection_add=[('epson_epos', 'Use an Epson printer')])
epson_printer_ip = fields.Char(string='Epson Printer IP Address', help="Local IP address of an Epson receipt printer.", default="0.0.0.0")
@api.constrains('epson_printer_ip')
def _constrains_epson_printer_ip(self):
for record in self:
if record.printer_type == 'epson_epos' and not record.epson_printer_ip:
raise ValidationError(_("Epson Printer IP Address cannot be empty."))