-
-
Notifications
You must be signed in to change notification settings - Fork 332
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[IMP] stock_barcodes: Performance and extra checks from 16.0
- Loading branch information
1 parent
1da71e4
commit 306a399
Showing
4 changed files
with
21 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,20 @@ | ||
# Copyright 2021 Tecnativa - Sergio Teruel | ||
# Copyright 2024 Tecnativa - Carlos Dauden | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). | ||
from odoo import tools | ||
|
||
|
||
def pre_init_hook(cr): | ||
if not tools.column_exists(cr, "stock_move_line", "barcode_scan_state"): | ||
cr.execute( | ||
""" | ||
ALTER TABLE stock_move_line | ||
ADD COLUMN barcode_scan_state varchar""" | ||
) | ||
cr.execute( | ||
""" | ||
UPDATE stock_move_line sml | ||
SET barcode_scan_state = 'pending' | ||
""" | ||
) | ||
cr.execute( | ||
""" | ||
ALTER TABLE stock_move_line | ||
ADD COLUMN IF NOT EXISTS barcode_scan_state VARCHAR DEFAULT 'pending'; | ||
ALTER TABLE stock_move_line ALTER COLUMN barcode_scan_state DROP DEFAULT; | ||
""" | ||
) | ||
cr.execute( | ||
""" | ||
ALTER TABLE stock_move | ||
ADD COLUMN IF NOT EXISTS barcode_backorder_action VARCHAR DEFAULT 'pending'; | ||
ALTER TABLE stock_move ALTER COLUMN barcode_backorder_action DROP DEFAULT; | ||
""" | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters