summaryrefslogtreecommitdiff
path: root/addons/payment/models
diff options
context:
space:
mode:
authorNicolas Lempereur <nle@odoo.com>2018-01-08 14:46:35 +0100
committerNicolas Lempereur <nle@odoo.com>2018-01-08 15:58:30 +0100
commitdc61861f90d15797b19f8ebddfb0c8a66d0afa88 (patch)
tree9b32e3341e59257f4c19d6a1ff659c81d3a9d2e8 /addons/payment/models
parent10c3b31d0f1221641e04365a33160b693abb6cdc (diff)
[FIX] payment: py3 error payment icon save
Code to thumbnail payment icon image had an error for python3 because from RPC the image would be a text string instead of an expected bytestring. This change accepts both and made another small fix in the view since image_medium doesn't exist (and image is already thumbnailed). A third fix was that removing an image caused an error. opw-803722 closes #22088
Diffstat (limited to 'addons/payment/models')
-rw-r--r--addons/payment/models/payment_acquirer.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/addons/payment/models/payment_acquirer.py b/addons/payment/models/payment_acquirer.py
index 82033d4375b..198f8c5d336 100644
--- a/addons/payment/models/payment_acquirer.py
+++ b/addons/payment/models/payment_acquirer.py
@@ -437,15 +437,17 @@ class PaymentIcon(models.Model):
@api.model
def create(self, vals):
if 'image' in vals:
- vals['image_payment_form'] = image_resize_image(vals['image'], size=(45,30))
- vals['image'] = image_resize_image(vals['image'], size=(64,64))
+ image = ustr(vals['image'] or '').encode('utf-8')
+ vals['image_payment_form'] = image_resize_image(image, size=(45,30))
+ vals['image'] = image_resize_image(image, size=(64,64))
return super(PaymentIcon, self).create(vals)
@api.multi
def write(self, vals):
if 'image' in vals:
- vals['image_payment_form'] = image_resize_image(vals['image'], size=(45,30))
- vals['image'] = image_resize_image(vals['image'], size=(64,64))
+ image = ustr(vals['image'] or '').encode('utf-8')
+ vals['image_payment_form'] = image_resize_image(image, size=(45,30))
+ vals['image'] = image_resize_image(image, size=(64,64))
return super(PaymentIcon, self).write(vals)
class PaymentTransaction(models.Model):