diff --git a/addons/payment/controllers/portal.py b/addons/payment/controllers/portal.py index a58a885696c..70147f78872 100644 --- a/addons/payment/controllers/portal.py +++ b/addons/payment/controllers/portal.py @@ -17,7 +17,8 @@ class WebsitePayment(http.Controller): 'pms': payment_tokens, 'acquirers': acquirers, 'return_url': return_url, - 'bootstrap_formatting': True + 'bootstrap_formatting': True, + 'partner_id': partner.id } return request.render("payment.pay_methods", values) diff --git a/addons/payment/models/payment_acquirer.py b/addons/payment/models/payment_acquirer.py index 4ee00721272..2bbc9cd8317 100644 --- a/addons/payment/models/payment_acquirer.py +++ b/addons/payment/models/payment_acquirer.py @@ -5,7 +5,7 @@ import logging import datetime from odoo import api, exceptions, fields, models, _ -from odoo.tools import consteq, float_round, image_resize_images, ustr, pycompat +from odoo.tools import consteq, float_round, image_resize_images, image_resize_image, ustr, pycompat from odoo.addons.base.module import module from odoo.exceptions import ValidationError @@ -420,14 +420,23 @@ class PaymentOption(models.Model): "resized as a 64x64px image, with aspect ratio preserved. " "Use this field anywhere a small image is required.") + image_payment_form = fields.Binary( + "Image displayed on the payment form", attachment=True) + @api.model def create(self, vals): image_resize_images(vals) + + if 'image' in vals: + self.image_payment_form = image_resize_image(vals['image'], size=(45,30)) + return super(PaymentOption, self).create(vals) @api.multi def write(self, vals): image_resize_images(vals) + if 'image' in vals: + self.image_payment_form = image_resize_image(vals['image'], size=(45,30)) return super(PaymentOption, self).write(vals) class PaymentTransaction(models.Model): diff --git a/addons/payment/static/src/js/payment_form.js b/addons/payment/static/src/js/payment_form.js index b1d503f340d..7cf5bb66c7a 100644 --- a/addons/payment/static/src/js/payment_form.js +++ b/addons/payment/static/src/js/payment_form.js @@ -316,12 +316,17 @@ odoo.define('payment.payment_form', function (require){ }, start: function() { this.updateNewPaymentDisplayStatus(); + $('[data-toggle="tooltip"]').tooltip(); + }, }); $(document).ready(function (){ + if (!$('.o_payment_form').length) { + return $.Deferred().reject("DOM doesn't contain '.o_payment_form'"); + } var form = new PaymentForm(); form.attachTo($('.o_payment_form')); }); diff --git a/addons/payment/static/src/less/payment_form.less b/addons/payment/static/src/less/payment_form.less index 14bb9ef8559..6ac08e221b1 100644 --- a/addons/payment/static/src/less/payment_form.less +++ b/addons/payment/static/src/less/payment_form.less @@ -33,4 +33,18 @@ border-top: 1px solid #ddd; padding: 1.14em !important; } + + .payment_option_list { + li { + padding-left: 5px !important; + padding-right: 0px !important; + } + + .more_option { + font-size:10px; + } + + margin-top: 0px !important; + margin-bottom: -5px !important; + } } \ No newline at end of file diff --git a/addons/payment/views/payment_templates.xml b/addons/payment/views/payment_templates.xml index e8360962043..370eda3e768 100644 --- a/addons/payment/views/payment_templates.xml +++ b/addons/payment/views/payment_templates.xml @@ -50,18 +50,27 @@ - +