[FIX] account: dashboard crashes when activity set on misc.op.
When you create an entry on Miscellaneous Operations journal and schedule an activity on that entry, the Accounting dashboard crashes and gets completely inaccessible because of an untranslated field on mail.activity.type. closes odoo/odoo#119318 Task: 3283382 Opw: 3277677 X-original-commit: 14481724cb5d6a164332586eb18f3195c6508b12 Signed-off-by: John Laterre (jol) <jol@odoo.com> Signed-off-by: Claire Bretton <clbr@odoo.com>
This commit is contained in:
@@ -61,13 +61,14 @@ class account_journal(models.Model):
|
||||
today = fields.Date.context_today(self)
|
||||
activities = defaultdict(list)
|
||||
# search activity on move on the journal
|
||||
lang = self.env.user.lang or get_lang(self.env).code
|
||||
sql_query = """
|
||||
SELECT activity.id,
|
||||
activity.res_id,
|
||||
activity.res_model,
|
||||
activity.summary,
|
||||
CASE WHEN activity.date_deadline < %(today)s THEN 'late' ELSE 'future' END as status,
|
||||
act_type.name as act_type_name,
|
||||
COALESCE(act_type.name->> %(lang)s, act_type.name->>'en_US') as act_type_name,
|
||||
act_type.category as activity_category,
|
||||
activity.date_deadline,
|
||||
move.date,
|
||||
@@ -79,7 +80,7 @@ class account_journal(models.Model):
|
||||
WHERE move.journal_id = ANY(%(ids)s)
|
||||
AND (act_type.category != 'tax_report' OR (act_type.category = 'tax_report' AND activity.date_deadline <= %(today)s))
|
||||
"""
|
||||
self.env.cr.execute(sql_query, {'ids': self.ids, 'today': today})
|
||||
self.env.cr.execute(sql_query, {'ids': self.ids, 'today': today, 'lang': lang})
|
||||
for activity in self.env.cr.dictfetchall():
|
||||
act = {
|
||||
'id': activity['id'],
|
||||
|
||||
Reference in New Issue
Block a user