From 7b33689b7bf6576f66b26f5e66f7a823450c564d Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Tue, 2 Jul 2019 08:08:34 +0000 Subject: [PATCH 1/4] [IMP] base: better and less conflicting version of e210faa676 Backport somewhat improved version of this fix (we don't need to check for the existing extension since we're not doing anything if there is an extension at all) merged into later branches, to avoid forward-port conflicts. closes odoo/odoo#34509 Signed-off-by: Xavier Morel (xmo) --- odoo/addons/base/ir/ir_http.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/odoo/addons/base/ir/ir_http.py b/odoo/addons/base/ir/ir_http.py index d991023d73b..179f0b4e935 100644 --- a/odoo/addons/base/ir/ir_http.py +++ b/odoo/addons/base/ir/ir_http.py @@ -322,9 +322,10 @@ class IrHttp(models.AbstractModel): # extension _, existing_extension = os.path.splitext(filename) - extension = mimetypes.guess_extension(mimetype) - if not existing_extension and extension and not filename.endswith(extension): - filename = "%s%s" % (filename, extension) + if not existing_extension: + extension = mimetypes.guess_extension(mimetype) + if extension: + filename = "%s%s" % (filename, extension) headers += [('Content-Type', mimetype), ('X-Content-Type-Options', 'nosniff')] From a8dfc7fb731dd6c34f55401d099ca1f72d796e9e Mon Sep 17 00:00:00 2001 From: Jorge Pinna Puissant Date: Mon, 8 Jul 2019 11:15:44 +0000 Subject: [PATCH 2/4] [FIX] website_payment: consider authorized transactions as done Before this commit, when a transaction has as status 'authorized', the transactions' confirm page gives an error : 'Oops! There was a problem with your payment.' Now, the page gives the same message as when the transaction has the status 'done' : 'Your payment was successful! It may take some time to be validated on our end.' opw-1984325 closes odoo/odoo#34652 Signed-off-by: Damien Bouvy (dbo) --- addons/website_payment/controllers/main.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/website_payment/controllers/main.py b/addons/website_payment/controllers/main.py index 9cc5818d826..80ed49cf8bd 100644 --- a/addons/website_payment/controllers/main.py +++ b/addons/website_payment/controllers/main.py @@ -78,8 +78,8 @@ class WebsitePayment(http.Controller): tx_id = request.session.pop('website_payment_tx_id', False) if tx_id: tx = request.env['payment.transaction'].browse(tx_id) - status = (tx.state == 'done' and 'success') or 'danger' - message = (tx.state == 'done' and _('Your payment was successful! It may take some time to be validated on our end.')) or _('Oops! There was a problem with your payment.') + status = (tx.state in ['done', 'authorized'] and 'success') or 'danger' + message = (tx.state in ['done', 'authorized'] and _('Your payment was successful! It may take some time to be validated on our end.')) or _('Oops! There was a problem with your payment.') if tx.acquirer_id and tx.acquirer_id.provider == 'transfer': status = (tx.state in ('done', 'pending') and 'success') or 'danger' if tx.state == 'done': From 7be62eb852023a7829ccd25107daccf2b5db41c5 Mon Sep 17 00:00:00 2001 From: vrenaville Date: Tue, 2 Jul 2019 12:30:32 +0000 Subject: [PATCH 3/4] [FIX] account: do not assing on empty recordset If a browse record is empty, assigning a value will fail Introduced at c04065abd8f62 Closes odoo/odoo#34521 closes odoo/odoo#34654 Signed-off-by: Martin Trigaux (mat) --- addons/account/models/partner.py | 1 - 1 file changed, 1 deletion(-) diff --git a/addons/account/models/partner.py b/addons/account/models/partner.py index 1b6e1474b35..5992df17541 100644 --- a/addons/account/models/partner.py +++ b/addons/account/models/partner.py @@ -261,7 +261,6 @@ class ResPartner(models.Model): def _invoice_total(self): account_invoice_report = self.env['account.invoice.report'] if not self.ids: - self.total_invoiced = 0.0 return True user_currency_id = self.env.user.company_id.currency_id.id From 0ec0a4a32e98f2288e419dcb0627cfd972f32034 Mon Sep 17 00:00:00 2001 From: Richard Mathot Date: Tue, 9 Jul 2019 12:26:46 +0000 Subject: [PATCH 4/4] [FIX] models: avoid Unicode error when translating that error message MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The patch fa492d87f42f97d05ba93255a77e24c35158fe62 has been backported from Odoo 12.0, that runs on Python 3. The string '\n\n({} {}, {} {})' to be formatted is a byte-string in Python 2, while the return value of _() is always a unicode-string. As format() is (too?) nice, it attempts to convert the unicode-strings into ascii in order to inject them in the format pattern. With some languages that are written in ascii, this works -- by chance. When you use non-ascii languages like Japanese, it fails. We then fix that issue by using unicode-strings in the formatting pattern. #OneCharacterPatch B-) opw-2032016 ----------------------------- For full technical understanding: Python 2.7.16 (default, Mar 11 2019, 18:59:25) [GCC 8.2.1 20181127] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> '{}'.format('test') 'test' >>> '{}'.format(u'test') 'test' >>> '{}'.format(u'エ') Traceback (most recent call last): File "", line 1, in UnicodeEncodeError: 'ascii' codec can't encode character u'\u30a8' in position 0: ordinal not in range(128) >>> u'{}'.format(u'エ') u'\u30a8' closes odoo/odoo#34698 Signed-off-by: Richard Mathot (rim) --- odoo/models.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/odoo/models.py b/odoo/models.py index 577ef080197..3c9daa02ce9 100644 --- a/odoo/models.py +++ b/odoo/models.py @@ -4474,7 +4474,7 @@ class BaseModel(object): # mark missing records in cache with a failed value exc = MissingError( _("Record does not exist or has been deleted.") - + '\n\n({} {}, {} {})'.format(_('Records:'), (self - existing).ids[:6], _('User:'), self._uid) + + u'\n\n({} {}, {} {})'.format(_('Records:'), (self - existing).ids[:6], _('User:'), self._uid) ) (self - existing)._cache.update(FailedValue(exc)) return existing