Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update account_journal_dashboard.py #13584

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions addons/account/models/account_journal_dashboard.py
Expand Up @@ -171,11 +171,11 @@ def get_journal_dashboard_datas(self):
elif self.type in ['sale', 'purchase']:
title = _('Bills to pay') if self.type == 'purchase' else _('Invoices owed to you')
# optimization to find total and sum of invoice that are in draft, open state
query = """SELECT state, amount_total, currency_id AS currency FROM account_invoice WHERE journal_id = %s AND state NOT IN ('paid', 'cancel');"""
query = """SELECT state, amount_total, residual_signed, currency_id AS currency FROM account_invoice WHERE journal_id = %s AND state NOT IN ('paid', 'cancel');"""
self.env.cr.execute(query, (self.id,))
query_results = self.env.cr.dictfetchall()
today = datetime.today()
query = """SELECT amount_total, currency_id AS currency FROM account_invoice WHERE journal_id = %s AND date < %s AND state = 'open';"""
query = """SELECT amount_total, residual_signed, currency_id AS currency FROM account_invoice WHERE journal_id = %s AND date < %s AND state = 'open';"""
self.env.cr.execute(query, (self.id, today))
late_query_results = self.env.cr.dictfetchall()
sum_draft = 0.0
Expand All @@ -188,7 +188,7 @@ def get_journal_dashboard_datas(self):
sum_draft += cur.compute(result.get('amount_total'), currency)
elif result.get('state') == 'open':
number_waiting += 1
sum_waiting += cur.compute(result.get('amount_total'), currency)
sum_waiting += cur.compute(result.get('residual_signed'), currency)
sum_late = 0.0
number_late = 0
for result in late_query_results:
Expand Down