Skip to content

Commit

Permalink
[IMP] sale_stock_prebook: speedup installation on existing DB
Browse files Browse the repository at this point in the history
  • Loading branch information
lmignon authored and mt-software-de committed Feb 7, 2025
1 parent 57f3768 commit 78655c2
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions sale_stock_prebook/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
from . import models
from .hooks import pre_init_hook
1 change: 1 addition & 0 deletions sale_stock_prebook/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,5 @@
],
"maintainers": ["mt-software-de"],
"license": "LGPL-3",
"pre_init_hook": "pre_init_hook",
}
7 changes: 7 additions & 0 deletions sale_stock_prebook/hooks.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
def pre_init_hook(cr):
# Add new column to avoid computing at install
cr.execute(
"ALTER TABLE sale_order "
"ADD COLUMN IF NOT EXISTS stock_is_reserved BOOLEAN default(FALSE)"
)
cr.execute("ALTER TABLE sale_order alter column stock_is_reserved drop default")

0 comments on commit 78655c2

Please sign in to comment.