@@ -106,6 +106,7 @@ class LeFilamentTdb(models.Model):
'pipe':0,
'pipe_win':0,
'pipe_to_win':0,
'pipe_n1':0,
'tresorerie':0,
'entree':0,
'sortie':0,
...
...
@@ -122,9 +123,10 @@ class LeFilamentTdb(models.Model):
(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(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) as pipe,
(select sum(planned_revenue*probability/100) from crm_lead where active=True and probability=100) as pipe_win,
(select sum(planned_revenue*probability/100) from crm_lead where active=True and probability!=100) as pipe_to_win,
(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,
(select sum(planned_revenue*probability/100) from crm_lead where active=True and probability=100 and (date_deadline < date_trunc('year', current_date + interval '1' year) or date_deadline is null) ) as pipe_win,
(select sum(planned_revenue*probability/100) from crm_lead where active=True and probability!=100 and (date_deadline < date_trunc('year', current_date + interval '1' year) or date_deadline is null) ) as pipe_to_win,
(select date from account_bank_statement ORDER BY ID DESC LIMIT 1) as date_maj,
(select sum(amount) from account_bank_statement_line ) as tresorerie,
(select sum(amount) from account_bank_statement_line where amount > 0 and date >= date_trunc('year', current_date) ) as entree,
...
...
@@ -140,16 +142,24 @@ class LeFilamentTdb(models.Model):
self._cr.execute("select sum(capital) as capital from hr_employee;")