From d18c83eecb7fff592de2942a472aaa0ddee64d3c Mon Sep 17 00:00:00 2001 From: Stephane Wirtel Date: Mon, 22 Dec 2008 09:42:11 +0100 Subject: [PATCH] [IMP] Use the tools.sql.drop_view_if_exists function bzr revid: stephane@tinyerp.com-20081222084211-rvypd3l6d6ao74px --- .../account_analytic_analysis.py | 3 ++- addons/crm_configuration/report/crm_report.py | 10 ++++++---- addons/report_timesheet/report_timesheet.py | 4 +++- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/addons/account_analytic_analysis/account_analytic_analysis.py b/addons/account_analytic_analysis/account_analytic_analysis.py index 60b3d9c2920..3e21272aa7f 100644 --- a/addons/account_analytic_analysis/account_analytic_analysis.py +++ b/addons/account_analytic_analysis/account_analytic_analysis.py @@ -22,6 +22,7 @@ import operator from osv import osv, fields from osv.orm import intersect +from tools.sql from tools.translate import _ @@ -619,7 +620,7 @@ class account_analytic_account_summary_month(osv.osv): } def init(self, cr): - cr.drop_view_if_exists('account_analytic_analysis_summary_month') + tools.sql.drop_view_if_exists(cr, 'account_analytic_analysis_summary_month') cr.execute('CREATE VIEW account_analytic_analysis_summary_month AS (' \ 'SELECT ' \ '(TO_NUMBER(TO_CHAR(d.month, \'YYYYMM\'), \'999999\') + (d.account_id * 1000000))::integer AS id, ' \ diff --git a/addons/crm_configuration/report/crm_report.py b/addons/crm_configuration/report/crm_report.py index 772a5c3c7a8..4395973dc17 100644 --- a/addons/crm_configuration/report/crm_report.py +++ b/addons/crm_configuration/report/crm_report.py @@ -21,6 +21,8 @@ ############################################################################## from osv import fields,osv +import tools.sql + AVAILABLE_STATES = [ ('draft','Draft'), ('open','Open'), @@ -47,7 +49,7 @@ class report_crm_case_section_categ2(osv.osv): _order = 'category2_id, section_id' def init(self, cr): - cr.drop_view_if_exists("report_crm_case_section_categ2") + tools.sql.drop_view_if_exists(cr, "report_crm_case_section_categ2") cr.execute(""" create view report_crm_case_section_categ2 as ( select @@ -86,7 +88,7 @@ class report_crm_case_section_stage(osv.osv): _order = 'stage_id, section_id' def init(self, cr): - cr.drop_view_if_exists("report_crm_case_section_stage") + tools.sql.drop_view_if_exists(cr, "report_crm_case_section_stage") cr.execute(""" create view report_crm_case_section_stage as ( select @@ -123,7 +125,7 @@ class report_crm_case_section_categ_stage(osv.osv): _order = 'stage_id, section_id, categ_id' def init(self, cr): - cr.drop_view_if_exists("report_crm_case_section_categ_stage") + tools.sql.drop_view_if_exists(cr, "report_crm_case_section_categ_stage") cr.execute(""" create view report_crm_case_section_categ_stage as ( select @@ -161,7 +163,7 @@ class report_crm_case_section_categ_categ2(osv.osv): _order = 'section_id, categ_id, category2_id' def init(self, cr): - cr.drop_view_if_exists("report_crm_case_section_categ_categ2") + tools.sql.drop_view_if_exists(cr, "report_crm_case_section_categ_categ2") cr.execute(""" create view report_crm_case_section_categ_categ2 as ( select diff --git a/addons/report_timesheet/report_timesheet.py b/addons/report_timesheet/report_timesheet.py index 341ca4d0c2e..4b05d0ef38c 100644 --- a/addons/report_timesheet/report_timesheet.py +++ b/addons/report_timesheet/report_timesheet.py @@ -22,6 +22,8 @@ from osv import fields,osv +import tools.sql + class report_timesheet_user(osv.osv): _name = "report_timesheet.user" _description = "Timesheet per day" @@ -34,7 +36,7 @@ class report_timesheet_user(osv.osv): } _order = 'name desc,user_id desc' def init(self, cr): - cr.drop_view_if_exists('report_timesheet_user') + tools.sql.drop_view_if_exists(cr, 'report_timesheet_user') cr.execute(""" create or replace view report_timesheet_user as ( select