From 749e5a713c29bccdf14e188416a71c1d69ccfe03 Mon Sep 17 00:00:00 2001 From: Benjamin <Benjamin@MBP-de-Benj.(none)> Date: Fri, 16 Jun 2017 17:22:15 +0200 Subject: [PATCH] [add] charges fixes dans res_company --- models/lefilament_tdb.py | 33 ++------------------------------- models/res_company.py | 1 + 2 files changed, 3 insertions(+), 31 deletions(-) diff --git a/models/lefilament_tdb.py b/models/lefilament_tdb.py index 0654741..f6b9772 100644 --- a/models/lefilament_tdb.py +++ b/models/lefilament_tdb.py @@ -63,8 +63,8 @@ class LeFilamentTdb(models.Model): encaisse = self.env.cr.fetchone()[0] ############## CHARGES ################ - self.env.cr.execute("select charges_fixes from res_company" ) - charges_fixes = self.env.cr.fetchone()[0] + # self.env.cr.execute("select charges_fixes from res_company" ) + # charges_fixes = self.env.cr.fetchone()[0] if not encaisse: encaisse = 0 @@ -151,32 +151,3 @@ class LeFilamentTdb(models.Model): -class LeFilamentData(models.Model): - _name = "lefilament.dashboard.data" - _auto = False - _description = "Donnees Annuelles" - - facture = fields.Float("Facturé") - pipe = fields.Float("Pipe") - tresorerie = fields.Float("Trésorerie") - commandes = fields.Float("Commandes en cours") - entree = fields.Float("Entrées") - sortie = fields.Float("Sorties") - variation = fields.Float("Variation") - - def init(self, cr): - tools.drop_view_if_exists(cr, 'lefilament_dashboard_data') - cr.execute(""" - CREATE OR REPLACE VIEW lefilament_dashboard_data AS ( - 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(planned_revenue*probability/100) from crm_lead where active=True) as pipe, - (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, - (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(price_subtotal-qty_invoiced*price_unit) from sale_order_line where invoice_status='to invoice') as commandes); """) - - - diff --git a/models/res_company.py b/models/res_company.py index e535daa..5828184 100644 --- a/models/res_company.py +++ b/models/res_company.py @@ -7,3 +7,4 @@ class res_company(models.Model): ca_target = fields.Integer( "Objectif Chiffre d'Affaire" ) charges_fixes = fields.Integer( "Charges Fixes" ) + -- GitLab