From 17a130428516d9dd8105f90e8c9a65a0b4e8901b Mon Sep 17 00:00:00 2001 From: Ronald Portier Date: Mon, 11 Jul 2016 15:30:46 +0200 Subject: [PATCH] [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 --- addons/hr_timesheet_sheet/hr_timesheet_sheet.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/addons/hr_timesheet_sheet/hr_timesheet_sheet.py b/addons/hr_timesheet_sheet/hr_timesheet_sheet.py index 8b622dc9b34..e7f8562cd57 100644 --- a/addons/hr_timesheet_sheet/hr_timesheet_sheet.py +++ b/addons/hr_timesheet_sheet/hr_timesheet_sheet.py @@ -26,7 +26,11 @@ from pytz import timezone import pytz 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 _ class hr_timesheet_sheet(osv.osv): @@ -555,6 +559,7 @@ class hr_timesheet_sheet_sheet_day(osv.osv): } 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 SELECT id, @@ -647,6 +652,7 @@ class hr_timesheet_sheet_sheet_account(osv.osv): } 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 ( select min(hrt.id) as id,