[MERGE] forward port branch 10.0 up to 0164c9dfcb
This commit is contained in:
@@ -324,7 +324,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
|
||||
|
||||
@@ -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):
|
||||
|
||||
@@ -316,6 +316,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:
|
||||
|
||||
Reference in New Issue
Block a user