From 2fb19756efaad85f3623cc2d205415afe84340bf Mon Sep 17 00:00:00 2001 From: "Claire Bretton (clbr)" Date: Thu, 20 Apr 2023 14:32:39 +0000 Subject: [PATCH] [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) Signed-off-by: Claire Bretton --- addons/account/models/account_journal_dashboard.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/addons/account/models/account_journal_dashboard.py b/addons/account/models/account_journal_dashboard.py index 1fa680debd8..29cbed536fe 100644 --- a/addons/account/models/account_journal_dashboard.py +++ b/addons/account/models/account_journal_dashboard.py @@ -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'],