[FIX] hr_expense: Email creation for Expense

Steps to reproduce the bug:

- Let's consider an expense product P with internal reference = 1 and sales price = 100€
- Let's consider an employee E with a work email address W
- Configure your domain alias as odoo.com
- Configure the expense alias as expense
- Send an email from W to expense@odoo.com with '1 P 100' as subject

Bug:

An expense had been created for E with P as product and 0€ as price

opw:2191939

closes odoo/odoo#46314

X-original-commit: bde7d4ecb2b4e7954753ff932467ce5618720580
Signed-off-by: Simon Goffin (sig) <sig@openerp.com>
This commit is contained in:
Goffin Simon
2020-02-26 10:15:15 +00:00
parent 806cb4aa43
commit 499853e273
+1 -1
View File
@@ -561,7 +561,7 @@ class HrExpense(models.Model):
product_code = expense_description.split(' ')[0]
product = self.env['product.product'].search([('can_be_expensed', '=', True), ('default_code', '=ilike', product_code)], limit=1)
if product:
expense_description = expense_description.replace(product_code, '')
expense_description = expense_description.replace(product_code, '', 1)
return product, expense_description