[MERGE] forward port branch 10.0 up to 1bcc856e4c
This commit is contained in:
@@ -356,6 +356,7 @@ class HrExpense(models.Model):
|
|||||||
expense_description = expense_description.replace(product_code.group(), '')
|
expense_description = expense_description.replace(product_code.group(), '')
|
||||||
products = self.env['product.product'].search([('default_code', 'ilike', product_code.group(1))]) or default_product
|
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]
|
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+)?'
|
pattern = '[-+]?(\d+(\.\d*)?|\.\d+)([eE][-+]?\d+)?'
|
||||||
# Match the last occurence of a float in the string
|
# Match the last occurence of a float in the string
|
||||||
@@ -382,6 +383,8 @@ class HrExpense(models.Model):
|
|||||||
'unit_amount': price,
|
'unit_amount': price,
|
||||||
'company_id': employee.company_id.id,
|
'company_id': employee.company_id.id,
|
||||||
})
|
})
|
||||||
|
if account:
|
||||||
|
custom_values['account_id'] = account.id
|
||||||
return super(HrExpense, self).message_new(msg_dict, custom_values)
|
return super(HrExpense, self).message_new(msg_dict, custom_values)
|
||||||
|
|
||||||
class HrExpenseSheet(models.Model):
|
class HrExpenseSheet(models.Model):
|
||||||
|
|||||||
@@ -685,6 +685,7 @@ class MassMailing(models.Model):
|
|||||||
'mass_mailing_id': mailing.id,
|
'mass_mailing_id': mailing.id,
|
||||||
'mailing_list_ids': [(4, l.id) for l in mailing.contact_list_ids],
|
'mailing_list_ids': [(4, l.id) for l in mailing.contact_list_ids],
|
||||||
'no_auto_thread': mailing.reply_to_mode != 'thread',
|
'no_auto_thread': mailing.reply_to_mode != 'thread',
|
||||||
|
'template_id': None,
|
||||||
}
|
}
|
||||||
if mailing.reply_to_mode == 'email':
|
if mailing.reply_to_mode == 'email':
|
||||||
composer_values['reply_to'] = mailing.reply_to
|
composer_values['reply_to'] = mailing.reply_to
|
||||||
|
|||||||
@@ -50,10 +50,10 @@ class GeoIPResolver(object):
|
|||||||
# Compatibility with Legacy database.
|
# Compatibility with Legacy database.
|
||||||
# Some ips cannot be located to a specific country. Legacy DB used to locate them in
|
# 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.
|
# 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 {
|
return {
|
||||||
'city': r.city.name,
|
'city': r.city.name,
|
||||||
'country_code': country.iso_code,
|
'country_code': getattr(country, attr),
|
||||||
'country_name': country.name,
|
'country_name': country.name,
|
||||||
'region': r.subdivisions[0].iso_code if r.subdivisions else None,
|
'region': r.subdivisions[0].iso_code if r.subdivisions else None,
|
||||||
'time_zone': r.location.time_zone,
|
'time_zone': r.location.time_zone,
|
||||||
|
|||||||
Reference in New Issue
Block a user