summaryrefslogtreecommitdiff
path: root/addons/hw_escpos
diff options
context:
space:
mode:
authorChristophe Simonis <chs@odoo.com>2019-08-21 10:10:11 +0200
committerChristophe Simonis <chs@odoo.com>2019-08-21 10:10:11 +0200
commit3faea8fbf810224ad4e03cfa1dc36f186800c501 (patch)
tree5e05c40d62dacc5951c70b3686f30a7bbb86f399 /addons/hw_escpos
parentcc2d78beeaf61fa0b8c9543196d1b4fce5cd5da6 (diff)
parentf26de445e5579913e27ea6a630bcee6d40eefc7d (diff)
[MERGE] forward port branch saas-12.4 up to f26de445e55
Diffstat (limited to 'addons/hw_escpos')
-rw-r--r--addons/hw_escpos/escpos/escpos.py25
1 files changed, 11 insertions, 14 deletions
diff --git a/addons/hw_escpos/escpos/escpos.py b/addons/hw_escpos/escpos/escpos.py
index d9f40d24816..59c276f82d9 100644
--- a/addons/hw_escpos/escpos/escpos.py
+++ b/addons/hw_escpos/escpos/escpos.py
@@ -893,24 +893,21 @@ class Escpos:
self._raw(PAPER_FULL_CUT)
- def cashdraw(self, pin, tries=5):
+ def cashdraw(self, pin):
""" Send pulse to kick the cash drawer
- With some printers the drawer will not open after one pulse, for this reason we will check
- the drawer status up to 'tries' times and send a new pulse if the drawer is still closed. If the
- drawer status is open, we will stop sending pulses.
+ For some reason, with some printers (ex: Epson TM-m30), the cash drawer
+ only opens 50% of the time if you just send the pulse. But if you read
+ the status afterwards, it opens all the time.
"""
- for i in range(tries):
- if pin == 2:
- self._raw(CD_KICK_2)
- elif pin == 5:
- self._raw(CD_KICK_5)
- else:
- raise CashDrawerError()
-
- if i != tries - 1 and not self.get_printer_status()['printer']['drawer_pin_high']:
- break
+ if pin == 2:
+ self._raw(CD_KICK_2)
+ elif pin == 5:
+ self._raw(CD_KICK_5)
+ else:
+ raise CashDrawerError()
+ self.get_printer_status()
def hw(self, hw):
""" Hardware operations """