[FIX] hr_timehseet_sheet: drop view before creation
When the schema of a view change (e.g. drop of column), the "CREATE OR REPLACE" will not be enough and dropping the view is required. Fixes #12754 Closes #12756
This commit is contained in:
parent
965024902d
commit
17a1304285
|
@ -26,7 +26,11 @@ from pytz import timezone
|
||||||
import pytz
|
import pytz
|
||||||
|
|
||||||
from openerp.osv import fields, osv
|
from openerp.osv import fields, osv
|
||||||
from openerp.tools import DEFAULT_SERVER_DATE_FORMAT, DEFAULT_SERVER_DATETIME_FORMAT
|
from openerp.tools import (
|
||||||
|
DEFAULT_SERVER_DATE_FORMAT,
|
||||||
|
DEFAULT_SERVER_DATETIME_FORMAT,
|
||||||
|
drop_view_if_exists,
|
||||||
|
)
|
||||||
from openerp.tools.translate import _
|
from openerp.tools.translate import _
|
||||||
|
|
||||||
class hr_timesheet_sheet(osv.osv):
|
class hr_timesheet_sheet(osv.osv):
|
||||||
|
@ -555,6 +559,7 @@ class hr_timesheet_sheet_sheet_day(osv.osv):
|
||||||
}
|
}
|
||||||
|
|
||||||
def init(self, cr):
|
def init(self, cr):
|
||||||
|
drop_view_if_exists(cr, 'hr_timesheet_sheet_sheet_day')
|
||||||
cr.execute("""create or replace view hr_timesheet_sheet_sheet_day as
|
cr.execute("""create or replace view hr_timesheet_sheet_sheet_day as
|
||||||
SELECT
|
SELECT
|
||||||
id,
|
id,
|
||||||
|
@ -647,6 +652,7 @@ class hr_timesheet_sheet_sheet_account(osv.osv):
|
||||||
}
|
}
|
||||||
|
|
||||||
def init(self, cr):
|
def init(self, cr):
|
||||||
|
drop_view_if_exists(cr, 'hr_timesheet_sheet_sheet_account')
|
||||||
cr.execute("""create or replace view hr_timesheet_sheet_sheet_account as (
|
cr.execute("""create or replace view hr_timesheet_sheet_sheet_account as (
|
||||||
select
|
select
|
||||||
min(hrt.id) as id,
|
min(hrt.id) as id,
|
||||||
|
|
Loading…
Reference in New Issue