[IMP] Use the tools.sql.drop_view_if_exists function

bzr revid: stephane@tinyerp.com-20081222084211-rvypd3l6d6ao74px
This commit is contained in:
Stephane Wirtel 2008-12-22 09:42:11 +01:00
parent 5ed4362d4c
commit d18c83eecb
3 changed files with 11 additions and 6 deletions

View File

@ -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, ' \

View File

@ -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

View File

@ -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