From 928e91c624d227eecb90160fba92ed755806387b Mon Sep 17 00:00:00 2001 From: Gert Pellin Date: Mon, 13 May 2019 09:48:43 +0000 Subject: [PATCH 1/3] [FIX] hw_escpos: cashdrawer doesn't open With some escpos printers the cash drawer did still not open after previous fixes. One of the problemetic printers is the Epson TM-m30. This fix will check the status of the drawer and try to open it up to 5 times. The fix is successfully tested with the TM-m30. closes odoo/odoo#33328 Signed-off-by: pimodoo --- addons/hw_escpos/escpos/escpos.py | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/addons/hw_escpos/escpos/escpos.py b/addons/hw_escpos/escpos/escpos.py index d278ede1787..de7e9121463 100644 --- a/addons/hw_escpos/escpos/escpos.py +++ b/addons/hw_escpos/escpos/escpos.py @@ -885,14 +885,23 @@ class Escpos: self._raw(PAPER_FULL_CUT) - def cashdraw(self, pin): - """ Send pulse to kick the cash drawer """ - if pin == 2: - self._raw(CD_KICK_2) - elif pin == 5: - self._raw(CD_KICK_5) - else: - raise CashDrawerError() + def cashdraw(self, pin, tries=5): + """ 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 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 def hw(self, hw): From 5d6656d739feff7abb8e191fdc038cc03b542d3b Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Wed, 15 May 2019 09:16:23 +0000 Subject: [PATCH 2/3] [FIX] mail: avoid concurrent update of notifications This revision is a backport of revision 56596e5240ef920df14d99087451ce6f06ac6d36 As the bug mentioned in the above revision occurs as well in Odoo 10.0 and 11.0. opw-1984293 closes odoo/odoo#33382 Signed-off-by: Denis Ledoux --- addons/mail/models/mail_mail.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/addons/mail/models/mail_mail.py b/addons/mail/models/mail_mail.py index 87305781784..27313fdb59d 100644 --- a/addons/mail/models/mail_mail.py +++ b/addons/mail/models/mail_mail.py @@ -267,6 +267,19 @@ class MailMail(models.Model): }) mail_sent = False + # Update notification in a transient exception state to avoid concurrent + # update in case an email bounces while sending all emails related to current + # mail record. + notifs = self.env['mail.notification'].search([ + ('is_email', '=', True), + ('mail_message_id', 'in', mail.mapped('mail_message_id').ids), + ('email_status', 'not in', ('sent', 'canceled')) + ]) + if notifs: + notifs.sudo().write({ + 'email_status': 'exception', + }) + # build an RFC2822 email.message.Message object and send it without queuing res = None for email in email_list: From 0164c9dfcb8f94dd09ffc5a0ce056e4e23308abe Mon Sep 17 00:00:00 2001 From: Nathan de Pryck Date: Thu, 2 May 2019 08:26:25 +0000 Subject: [PATCH 3/3] [FIX] Account:rounding poorly applied Rounding each element of the sum decrease the precision and prevent to reconcile large recordset. closes odoo/odoo#33100 Signed-off-by: Laurent Smet --- addons/account/models/account_move.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/account/models/account_move.py b/addons/account/models/account_move.py index 9de4266646e..7208e14f935 100644 --- a/addons/account/models/account_move.py +++ b/addons/account/models/account_move.py @@ -322,7 +322,7 @@ class AccountMoveLine(models.Model): else: date = partial_line.credit_move_id.date if partial_line.debit_move_id == line else partial_line.debit_move_id.date rate = line.currency_id.with_context(date=date).rate - amount_residual_currency += sign_partial_line * line.currency_id.round(partial_line.amount * rate) + amount_residual_currency += sign_partial_line * partial_line.amount * rate #computing the `reconciled` field. As we book exchange rate difference on each partial matching, #we can only check the amount in company currency