Browse Source
Merge pull request #491 from Tecnativa/8.0-account_financial_report_webkit-fix_error_if_column_exists
[FIX] account_financial_report_webkit: Fix error if column exists
pull/635/head
Pedro M. Baeza
6 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with
19 additions and
13 deletions
-
account_financial_report_webkit/README.rst
-
account_financial_report_webkit/hooks.py
|
@ -166,6 +166,7 @@ Contributors |
|
|
* Guewen Baconnier |
|
|
* Guewen Baconnier |
|
|
* David Dufresne <david.dufresne@savoirfairelinux.com> |
|
|
* David Dufresne <david.dufresne@savoirfairelinux.com> |
|
|
* Luc De Meyer <luc.demeyer@noviat.com> |
|
|
* Luc De Meyer <luc.demeyer@noviat.com> |
|
|
|
|
|
* Jairo Llopis <jairo.llopis@tecnativa.com> |
|
|
|
|
|
|
|
|
Maintainer |
|
|
Maintainer |
|
|
---------- |
|
|
---------- |
|
|
|
@ -1,12 +1,15 @@ |
|
|
# -*- coding: utf-8 -*- |
|
|
# -*- coding: utf-8 -*- |
|
|
# © 2017 Therp BV <http://therp.nl> |
|
|
# © 2017 Therp BV <http://therp.nl> |
|
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). |
|
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). |
|
|
|
|
|
from psycopg2 import ProgrammingError |
|
|
|
|
|
|
|
|
from .models.account_move_line import AccountMoveLine |
|
|
from .models.account_move_line import AccountMoveLine |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def pre_init_hook(cr): |
|
|
def pre_init_hook(cr): |
|
|
with cr.savepoint(): |
|
|
|
|
|
# don't break if column exists |
|
|
# don't break if column exists |
|
|
|
|
|
try: |
|
|
|
|
|
with cr.savepoint(): |
|
|
cr.execute( |
|
|
cr.execute( |
|
|
'alter table account_move_line add column last_rec_date date', |
|
|
'alter table account_move_line add column last_rec_date date', |
|
|
) |
|
|
) |
|
@ -18,6 +21,8 @@ def pre_init_hook(cr): |
|
|
'create index account_move_line_last_rec_date_index ' |
|
|
'create index account_move_line_last_rec_date_index ' |
|
|
'on account_move_line (last_rec_date)', |
|
|
'on account_move_line (last_rec_date)', |
|
|
) |
|
|
) |
|
|
|
|
|
except ProgrammingError: |
|
|
|
|
|
pass |
|
|
# but still do the initialization |
|
|
# but still do the initialization |
|
|
cr.execute( |
|
|
cr.execute( |
|
|
"""update account_move_line |
|
|
"""update account_move_line |
|
|