diff --git a/models/lefilament_tdb.py b/models/lefilament_tdb.py index 185a7f6fbcc2b48de396c43be8f8ed8ba0118a47..5d4e3af5faa86a34add08d00d19d679849cfd61c 100644 --- a/models/lefilament_tdb.py +++ b/models/lefilament_tdb.py @@ -121,7 +121,7 @@ class LeFilamentTdb(models.Model): self._cr.execute(""" SELECT (select count(*) from account_invoice) as id, - (select sum(amount_untaxed) from account_invoice where state!='draft' and type='out_invoice' and date >= date_trunc('year', current_date) ) as facture, + (select sum(amount_untaxed) from account_invoice where state!='draft' and type='out_invoice' and date >= date_trunc('year', current_date) and date < date_trunc('year', current_date + interval '1' year) ) as facture, (select sum(residual_company_signed) from account_invoice where state!='draft' and type='out_invoice' ) as a_encaisser, (select sum(planned_revenue*probability/100) from crm_lead where active=True and (date_deadline < date_trunc('year', current_date + interval '1' year) or date_deadline is null) ) as pipe, (select sum(planned_revenue*probability/100) from crm_lead where active=True and date_deadline >= date_trunc('year', current_date + interval '1' year) ) as pipe_n1, @@ -132,7 +132,7 @@ class LeFilamentTdb(models.Model): (select sum(amount) from account_bank_statement_line where amount > 0 and date >= date_trunc('year', current_date) ) as entree, (select sum(amount) from account_bank_statement_line where amount < 0 and date >= date_trunc('year', current_date) ) as sortie, (select sum(amount) from account_bank_statement_line where date >= date_trunc('year', current_date) ) as variation, - (select sum(es.total_amount) from hr_expense_sheet es, hr_expense e where es.id = e.sheet_id and e.payment_mode='own_account' and es.state!='done' ) as cca, + (select sum(total_amount) from hr_expense where payment_mode='own_account' and state!='done' ) as cca, (select sum(price_subtotal-qty_invoiced*price_unit) from sale_order_line where invoice_status='to invoice') as commandes; """) datas = self._cr.dictfetchall()