From e48767fe6509c9dc5bb3c0907ad36d16c4b5b773 Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Mon, 14 May 2018 16:33:55 +0200 Subject: [PATCH 1/2] [FIX] mass_mailing: force to not use a template for the rendering If the user configures a default `template_id` for the `mail.compose.message`, this template was used by the mass mailing to render the email, and, among others, it therefore used the `email_to` of this email template, to render the recipients, and it was configured empty or something else than `object.id`, it did not used the `active_ids` passed in the context to the `mail.compose.message` `create` call to compute the correct recipients To reproduce: - In developer mode (?debug) - Open the full mail compose message e.g. in app sales, open a so, hit new message, and hit the button to open the full message composer - Set the template to the quotation template is not there already - In the debug menu of the dialog, View > Set defaults, - Click the radio button to all users, and the default to Use template = ... - Then, try to send a mass mailing. It will fail because it cannot compute the `email_to` values correctly because the `email_to` of the quotation template is empty. opw-1840287 --- addons/mass_mailing/models/mass_mailing.py | 1 + 1 file changed, 1 insertion(+) diff --git a/addons/mass_mailing/models/mass_mailing.py b/addons/mass_mailing/models/mass_mailing.py index 154acd47bd8..340d4c8ccb8 100644 --- a/addons/mass_mailing/models/mass_mailing.py +++ b/addons/mass_mailing/models/mass_mailing.py @@ -785,6 +785,7 @@ class MassMailing(osv.Model): 'mass_mailing_id': mailing.id, 'mailing_list_ids': [(4, l.id) for l in mailing.contact_list_ids], 'no_auto_thread': mailing.reply_to_mode != 'thread', + 'template_id': None, } if mailing.reply_to_mode == 'email': composer_values['reply_to'] = mailing.reply_to From 045086839184d89e6aa11b4938d5f685ce607513 Mon Sep 17 00:00:00 2001 From: Christophe Simonis Date: Mon, 14 May 2018 19:54:50 +0200 Subject: [PATCH 2/2] [FIX] website: correct GeoIP Legacy compatibility Attribute is different for country and continent objects. --- addons/website/geoipresolver.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/website/geoipresolver.py b/addons/website/geoipresolver.py index e95b9318eb2..24bbe723d6d 100644 --- a/addons/website/geoipresolver.py +++ b/addons/website/geoipresolver.py @@ -50,10 +50,10 @@ class GeoIPResolver(object): # Compatibility with Legacy database. # Some ips cannot be located to a specific country. Legacy DB used to locate them in # continent instead of country. Do the same to not change behavior of existing code. - country = r.country if r.country.geoname_id else r.continent + country, attr = (r.country, 'iso_code') if r.country.geoname_id else (r.continent, 'code') return { 'city': r.city.name, - 'country_code': country.iso_code, + 'country_code': getattr(country, attr), 'country_name': country.name, 'region': r.subdivisions[0].iso_code if r.subdivisions else None, 'time_zone': r.location.time_zone,