[FIX] account: Error message creating journal

- Let's create a new company C with the name = "Company.name"
- Create a new journal in C

Bug:

A UserError was raised saying:

You cannot use anything else than unaccented latin characters in the alias address.

opw:2321023

closes odoo/odoo#57018

X-original-commit: 953389546f191e3fdb5e9dd994ab663ea9228b5d
Signed-off-by: Simon Goffin (sig) <sig@openerp.com>
This commit is contained in:
Goffin Simon
2020-09-03 10:42:22 +00:00
parent a14a8e59ba
commit 613752e051
+2 -1
View File
@@ -3,6 +3,7 @@ from odoo import api, fields, models, _
from odoo.osv import expression
from odoo.exceptions import UserError, ValidationError
from odoo.addons.base.models.res_bank import sanitize_account_number
import re
class AccountJournalGroup(models.Model):
@@ -356,7 +357,7 @@ class AccountJournal(models.Model):
if not alias_name:
alias_name = self.name
if self.company_id != self.env.ref('base.main_company'):
alias_name += '-' + str(self.company_id.name)
alias_name += '-' + re.sub("[^\w!#$%&'*+/=?^`{|}~\-]", '', str(self.company_id.name))
return {
'alias_defaults': {'move_type': type == 'purchase' and 'in_invoice' or 'out_invoice', 'company_id': self.company_id.id, 'journal_id': self.id},
'alias_parent_thread_id': self.id,