From d1c4d16a3a54aa41a460d879c04c985e551c624a Mon Sep 17 00:00:00 2001 From: Matthieu Dietrich Date: Fri, 8 May 2015 09:31:44 +0200 Subject: [PATCH 1/2] [FIX] account: Don't copy many2many when copying statement line When duplicating confirmed bank statement lines, the many2many `move_ids` links were preserved, and, therefore, there were links between the duplicated lines and the move entries of the original lines. Closes #6617 --- addons/account/account_bank_statement.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/addons/account/account_bank_statement.py b/addons/account/account_bank_statement.py index 1971019d464..b469c49deb2 100644 --- a/addons/account/account_bank_statement.py +++ b/addons/account/account_bank_statement.py @@ -577,6 +577,13 @@ class account_bank_statement_line(osv.osv): 'type': 'general', } + def copy(self, cr, uid, id, default=None, context=None): + if default is None: + default = {} + default = dict(default, move_ids=[]) + return super(account_bank_statement_line, self).copy( + cr, uid, id, default=default, context=context) + account_bank_statement_line() # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: From 242e61796b9d4f5d1e396148571ab26020ed8129 Mon Sep 17 00:00:00 2001 From: Olivier LAURENT Date: Tue, 12 May 2015 17:51:29 +0200 Subject: [PATCH 2/2] [FIX] mail: missing spaces in email subjects composed of several encoding sometimes some blank spaces are lost in subject of some incoming messages There is a bug in `decode_header` in Python < 3.3, which leads to lost some spaces in the email subjects when several encodings are used in this subject. See - Issue: http://bugs.python.org/issue1079 - Fix: https://hg.python.org/cpython/rev/8c03fe231877 Joining the strings returned in the result of `decode_header` solves most cases. Only extreme cases, like having a subject with several different encodings following each other without white spaces between them could lead to have extra spaces in the subject. It won't happen most of the time. Closes #6629 --- addons/crm_claim/test/process/claim.yml | 2 +- addons/mail/mail_message.py | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/addons/crm_claim/test/process/claim.yml b/addons/crm_claim/test/process/claim.yml index 45ca7cf2962..48be112952d 100644 --- a/addons/crm_claim/test/process/claim.yml +++ b/addons/crm_claim/test/process/claim.yml @@ -16,7 +16,7 @@ claim_ids = self.search(cr, uid, [('email_from','=', 'Mr. John Right ')]) assert claim_ids and len(claim_ids), "Claim is not created after getting request" claim = self.browse(cr, uid, claim_ids[0], context=context) - assert claim.name == tools.ustr("demande derèglement de votre produit."), "Subject does not match" + assert claim.name == tools.ustr("demande de règlement de votre produit."), "Subject does not match" - I open customer claim. - diff --git a/addons/mail/mail_message.py b/addons/mail/mail_message.py index f05320aee25..8898b1a7f4c 100644 --- a/addons/mail/mail_message.py +++ b/addons/mail/mail_message.py @@ -41,7 +41,9 @@ def decode(text): """Returns unicode() string conversion of the the given encoded smtp header text""" if text: text = decode_header(text.replace('\r', '')) - return ''.join([tools.ustr(x[0], x[1]) for x in text]) + # The joining space will not be needed as of Python 3.3 + # See https://hg.python.org/cpython/rev/8c03fe231877 + return ' '.join([tools.ustr(x[0], x[1]) for x in text]) class mail_message(osv.Model):