[FIX] pos_epson_printer: disable cashdrawer when parent option is unchecked

Open POS Config
Enable the option 'Connect Devices'
In 'Epson Receipt Printer IP Address' write anything then focus out
Enable the 'Cashdrawer' Option
Empty 'Epson Receipt Printer IP Address'
Disable'Connect Devices'
Save

Blanking 'Epson Receipt Printer IP Address' leaving 'Cashdrawer' on
will lead to crash during the payment session if the user click on
'Open Cashbox' when using cash as a payment method.

'Cashdrawer' should be disabled automatically when needed.

opw-2367498

closes odoo/odoo#61086

X-original-commit: 6491f9b20570c374e464194cbce698b00c173847
Signed-off-by: agr-odoo <agr-odoo@users.noreply.github.com>
This commit is contained in:
Andrea Grazioso (agr-odoo)
2020-10-30 17:30:56 +00:00
parent 33b35286cb
commit b9d4976a97
@@ -1,9 +1,14 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import fields, models
from odoo import api, fields, models
class PosConfig(models.Model):
_inherit = 'pos.config'
epson_printer_ip = fields.Char(string='Epson Printer IP', help="Local IP address of an Epson receipt printer.")
@api.onchange('epson_printer_ip')
def _onchange_epson_printer_ip(self):
if self.epson_printer_ip in (False, ''):
self.iface_cashdrawer = False