[FIX] account: display the move to check

Steps to reproduce:
- Set "To Check" for a bill in the Bill list view
- go back to the dashboard

Issue:
There won't be the "To Check" shortcut as it was the case in 15.0

opw-3455414

closes odoo/odoo#134432

X-original-commit: d8498091bc6e2cd441f5e4387e3833d1a2a1abc0
Signed-off-by: William André (wan) <wan@odoo.com>
Signed-off-by: Yolann Sabaux (yosa) <yosa@odoo.com>
This commit is contained in:
Yolann Sabaux
2023-09-12 07:12:32 +00:00
parent bb3d665079
commit 547a48f77b
@@ -449,7 +449,7 @@ class account_journal(models.Model):
late_query_results = group_by_journal(self.env.cr.dictfetchall())
to_check_vals = {
vals['journal_id']: vals
vals['journal_id'][0]: vals
for vals in self.env['account.move'].read_group(
domain=[('journal_id', 'in', sale_purchase_journals.ids), ('to_check', '=', True)],
fields=['amount_total_signed'],
@@ -467,7 +467,7 @@ class account_journal(models.Model):
(number_late, sum_late) = self._count_results_and_sum_amounts(late_query_results[journal.id], currency, curr_cache=curr_cache)
to_check = to_check_vals.get(journal.id, {})
dashboard_data[journal.id].update({
'number_to_check': to_check.get('__count', 0),
'number_to_check': to_check.get('journal_id_count', 0),
'to_check_balance': to_check.get('amount_total_signed', 0),
'title': _('Bills to pay') if journal.type == 'purchase' else _('Invoices owed to you'),
'number_draft': number_draft,
@@ -486,7 +486,7 @@ class account_journal(models.Model):
if not general_journals:
return
to_check_vals = {
vals['journal_id']: vals
vals['journal_id'][0]: vals
for vals in self.env['account.move'].read_group(
domain=[('journal_id', 'in', general_journals.ids), ('to_check', '=', True)],
fields=['amount_total_signed'],
@@ -495,7 +495,7 @@ class account_journal(models.Model):
)
}
for journal in general_journals:
vals = to_check_vals.get('journal_id', {})
vals = to_check_vals.get(journal.id, {})
dashboard_data[journal.id].update({
'number_to_check': vals.get('__count', 0),
'to_check_balance': vals.get('amount_total_signed', 0),