diff options
| author | BVE <bve@odoo.com> | 2021-05-07 13:09:57 +0000 |
|---|---|---|
| committer | BVE <bve@odoo.com> | 2021-05-10 10:03:33 +0000 |
| commit | 279dcbe7232fbd331902ec557f6c85b51ca522c0 (patch) | |
| tree | 2712bd0e8e6f0adf4495c28960700738443aed2b /addons/account | |
| parent | d1d523e4836195da6b081253f258a2653f35ded2 (diff) | |
[FIX] account: digest email revenu values correction
The value taken into account in the SQL for the calculation were wrong:
- Not based on the state of the invoices (cancelled and draft
were taken into account)
- Had the tax included
opw-2464004
feedback-2478356
closes odoo/odoo#70586
X-original-commit: fafea72843e25e0fee091ca935df61edb9133f6f
Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
Diffstat (limited to 'addons/account')
| -rw-r--r-- | addons/account/models/digest.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/addons/account/models/digest.py b/addons/account/models/digest.py index d3a798ebb25..4a25f820b9e 100644 --- a/addons/account/models/digest.py +++ b/addons/account/models/digest.py @@ -17,12 +17,13 @@ class Digest(models.Model): for record in self: start, end, company = record._get_kpi_compute_parameters() self._cr.execute(''' - SELECT SUM(line.debit) + SELECT -SUM(line.balance) FROM account_move_line line JOIN account_move move ON move.id = line.move_id - JOIN account_journal journal ON journal.id = move.journal_id + JOIN account_account account ON account.id = line.account_id WHERE line.company_id = %s AND line.date >= %s AND line.date < %s - AND journal.type = 'sale' + AND account.internal_group = 'income' + AND move.state = 'posted' ''', [company.id, start, end]) query_res = self._cr.fetchone() record.kpi_account_total_revenue_value = query_res and query_res[0] or 0.0 |
