Use party language for employees notifications

issue8693
review250011002
This commit is contained in:
Sergi Almacellas Abellana committed 2019-10-03 10:10:20 +02:00
1 parent 3480e3bfec
commit 4e9250a6e4
2 files changed
+9

No files matched your search

+2
View File
@@ -1,3 +1,5 @@
* Use party language for employees notifications
Version 5.2.0 - 2019-05-06
* Bug fixes (see mercurial logs for details)
* Add employee as recipients
+7
View File
@@ -190,6 +190,10 @@ class Email(ModelSQL, ModelView):
WebUser = pool.get('web.user')
except KeyError:
WebUser = None
try:
Employee = pool.get('company.employee')
except KeyError:
Employee = None
if isinstance(record, User):
if record.language:
return record.language
@@ -199,6 +203,9 @@ class Email(ModelSQL, ModelView):
elif WebUser and isinstance(record, WebUser):
if record.party and record.party.lang:
return record.party.lang
elif Employee and isinstance(record, Employee):
if record.party.lang:
return record.party.lang
lang, = Lang.search([
('code', '=', Configuration.get_language()),
], limit=1)