[FIX] Drop the view if exists
lp bug: https://launchpad.net/bugs/309331 fixed bzr revid: stephane@tinyerp.com-20081218140248-v63zqpaofph4ool4
This commit is contained in:
parent
90b8def6d9
commit
1c4534fa75
|
@ -617,8 +617,9 @@ class account_analytic_account_summary_month(osv.osv):
|
|||
string='Total Time'),
|
||||
'month': fields.char('Month', size=25, readonly=True),
|
||||
}
|
||||
|
||||
def init(self, cr):
|
||||
cr.execute('DROP VIEW IF EXISTS account_analytic_analysis_summary_month')
|
||||
cr.drop_view_if_exists('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, ' \
|
||||
|
|
|
@ -29,12 +29,6 @@ AVAILABLE_STATES = [
|
|||
('pending','Pending')
|
||||
]
|
||||
|
||||
def drop_view_if_exists(cr, viewname):
|
||||
cr.execute("select count(1) from pg_class where relkind=%s and relname=%s", ('v', viewname,))
|
||||
if cr.fetchone()[0]:
|
||||
cr.execute("DROP view %s" % (viewname,))
|
||||
cr.commit()
|
||||
|
||||
class report_crm_case_section_categ2(osv.osv):
|
||||
_name = "report.crm.case.section.categ2"
|
||||
_description = "Cases by section and category2"
|
||||
|
@ -53,7 +47,7 @@ class report_crm_case_section_categ2(osv.osv):
|
|||
_order = 'category2_id, section_id'
|
||||
|
||||
def init(self, cr):
|
||||
drop_view_if_exists(cr, "report_crm_case_section_categ2")
|
||||
cr.drop_view_if_exists("report_crm_case_section_categ2")
|
||||
cr.execute("""
|
||||
create view report_crm_case_section_categ2 as (
|
||||
select
|
||||
|
|
Loading…
Reference in New Issue