[MERGE] forward port branch 10.0 up to 1bcc856e4c

This commit is contained in:
Christophe Simonis
2018-05-14 20:14:27 +02:00
3 changed files with 6 additions and 2 deletions
+3
View File
@@ -356,6 +356,7 @@ class HrExpense(models.Model):
expense_description = expense_description.replace(product_code.group(), '')
products = self.env['product.product'].search([('default_code', 'ilike', product_code.group(1))]) or default_product
product = products.filtered(lambda p: p.default_code == product_code.group(1)) or products[0]
account = product.product_tmpl_id._get_product_accounts()['expense']
pattern = '[-+]?(\d+(\.\d*)?|\.\d+)([eE][-+]?\d+)?'
# Match the last occurence of a float in the string
@@ -382,6 +383,8 @@ class HrExpense(models.Model):
'unit_amount': price,
'company_id': employee.company_id.id,
})
if account:
custom_values['account_id'] = account.id
return super(HrExpense, self).message_new(msg_dict, custom_values)
class HrExpenseSheet(models.Model):
@@ -685,6 +685,7 @@ class MassMailing(models.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
+2 -2
View File
@@ -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,