diff --git a/models/lefilament_tdb.py b/models/lefilament_tdb.py index bba7603237cda3a237c6e72d5f3dd9267aadc626..804042ee4240733b2bc97139b88db48060372765 100644 --- a/models/lefilament_tdb.py +++ b/models/lefilament_tdb.py @@ -38,7 +38,7 @@ class LeFilamentTdb(models.Model): ############## CA ################ # FACTURÉ - self.env.cr.execute("select sum(amount_untaxed) from account_invoice where state!='draft' and type='out_invoice' and date >= date_trunc('month', %s) and date < date_trunc('month', %s + interval '1' month);", (date_tdb, date_tdb) ) + self.env.cr.execute("select sum(amount_untaxed_signed) from account_invoice where state!='draft' and (type='out_invoice' or type='out_refund') and date >= date_trunc('month', %s) and date < date_trunc('month', %s + interval '1' month);", (date_tdb, date_tdb) ) ca_mois = self.env.cr.fetchone()[0] ############## COMMANDES ################ @@ -125,7 +125,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) and date < date_trunc('year', current_date + interval '1' year) ) as facture, + (select sum(amount_untaxed_signed) from account_invoice where state!='draft' and (type='out_invoice' or type='out_refund') 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(residual_company_signed) from account_invoice where state!='draft' and type='in_invoice' ) as a_payer, (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,