From e4731d0327b77da7f3013c13caa606951dbb0a69 Mon Sep 17 00:00:00 2001 From: Goffin Simon Date: Mon, 23 Apr 2018 13:33:31 +0200 Subject: [PATCH 1/3] [FIX] base: Traceback when creating a partner with an ascii character Steps to reproduce: - Go to the Contact - Create a new contact with an email address with an ascii character Bug: A traceback was raised. Closes #19852 opw:1837714 --- odoo/addons/base/res/res_partner.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/odoo/addons/base/res/res_partner.py b/odoo/addons/base/res/res_partner.py index 9184a9ec68a..df7cc6660fe 100644 --- a/odoo/addons/base/res/res_partner.py +++ b/odoo/addons/base/res/res_partner.py @@ -700,7 +700,7 @@ class Partner(models.Model, FormatAddress): def _get_gravatar_image(self, email): gravatar_image = False - email_hash = hashlib.md5(email.lower()).hexdigest() + email_hash = hashlib.md5(email.lower().encode('utf-8')).hexdigest() url = "https://www.gravatar.com/avatar/" + email_hash try: image_content = urllib2.urlopen(url + "?d=404&s=128", timeout=5).read() From 29c6c06de74345b43be6d095c161280a83c30206 Mon Sep 17 00:00:00 2001 From: Nicolas Lempereur Date: Mon, 23 Apr 2018 13:03:11 +0200 Subject: [PATCH 2/3] [FIX] account_check_writing: write multi payment When you pay multiple invoice with one payment, you need the write permission on account.journal, this had been solved when registering a payment for one invoice in 91ca84644 In this commit, the same logic is applied on account.register.payments opw-1835888 opw-1834343 closes #24369 --- addons/account_check_printing/models/account_payment.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/addons/account_check_printing/models/account_payment.py b/addons/account_check_printing/models/account_payment.py index d4ab83da890..42515a8e20b 100644 --- a/addons/account_check_printing/models/account_payment.py +++ b/addons/account_check_printing/models/account_payment.py @@ -12,7 +12,7 @@ class AccountRegisterPayments(models.TransientModel): _inherit = "account.register.payments" check_amount_in_words = fields.Char(string="Amount in Words") - check_manual_sequencing = fields.Boolean(related='journal_id.check_manual_sequencing') + check_manual_sequencing = fields.Boolean(related='journal_id.check_manual_sequencing', readonly=1) # Note: a check_number == 0 means that it will be attributed when the check is printed check_number = fields.Integer(string="Check Number", readonly=True, copy=False, default=0, help="Number of the check corresponding to this payment. If your pre-printed check are not already numbered, " @@ -35,7 +35,6 @@ class AccountRegisterPayments(models.TransientModel): res = super(AccountRegisterPayments, self).get_payment_vals() if self.payment_method_id == self.env.ref('account_check_printing.account_payment_method_check'): res.update({ - 'check_amount_in_words': self.check_amount_in_words, 'check_manual_sequencing': self.check_manual_sequencing, }) return res From 76c17ab3f5dcde654543ba595821b76fe3bcadb8 Mon Sep 17 00:00:00 2001 From: Toufik Benjaa Date: Fri, 20 Apr 2018 18:08:19 +0200 Subject: [PATCH 3/3] [FIX] stripe: Fix float representation error MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Stripe needs to have the amount in integer, so we have to multiply by 100 the amount. Which sometimes create float representation errors and remove/add ~1 cent on some transactions (i.e 72.60€) --- addons/payment_stripe/models/payment.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/payment_stripe/models/payment.py b/addons/payment_stripe/models/payment.py index 515dd3bcd1c..0d33fbe3d01 100644 --- a/addons/payment_stripe/models/payment.py +++ b/addons/payment_stripe/models/payment.py @@ -7,6 +7,7 @@ from odoo import api, fields, models, _ from odoo.addons.payment.models.payment_acquirer import ValidationError from odoo.exceptions import UserError from odoo.tools.safe_eval import safe_eval +from odoo.tools.float_utils import float_round _logger = logging.getLogger(__name__) @@ -90,7 +91,7 @@ class PaymentTransactionStripe(models.Model): def _create_stripe_charge(self, acquirer_ref=None, tokenid=None, email=None): api_url_charge = 'https://%s/charges' % (self.acquirer_id._get_stripe_api_url()) charge_params = { - 'amount': int(self.amount if self.currency_id.name in INT_CURRENCIES else self.amount*100), + 'amount': int(self.amount if self.currency_id.name in INT_CURRENCIES else float_round(self.amount * 100, 2)), 'currency': self.currency_id.name, 'metadata[reference]': self.reference }