Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docsource/modules180-190.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1094,7 +1094,7 @@ Module coverage 18.0 -> 19.0
+---------------------------------------------------+----------------------+-------------------------------------------------+
| stock_dropshipping |Nothing to do |No DB layout changes. |
+---------------------------------------------------+----------------------+-------------------------------------------------+
| stock_fleet | | |
| stock_fleet |Done | |
+---------------------------------------------------+----------------------+-------------------------------------------------+
| stock_landed_costs | | |
+---------------------------------------------------+----------------------+-------------------------------------------------+
Expand Down
46 changes: 46 additions & 0 deletions openupgrade_scripts/scripts/stock_fleet/19.0.1.0/post-migration.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Copyright 2026 Heliconia Solutions Pvt. Ltd.
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from openupgradelib import openupgrade


@openupgrade.migrate()
def migrate(env, version):
migrate_dock_locations(env)
set_dispatch_management(env)


def migrate_dock_locations(env):
"""Link legacy is_a_dock locations to outgoing picking types as dock_ids."""
legacy_is_a_dock = openupgrade.get_legacy_name("is_a_dock")
env.cr.execute(
f"""
INSERT INTO dock_location_stock_picking_type_rel (
stock_picking_type_id, stock_location_id
)
SELECT spt.id, sl.id
FROM stock_location sl
JOIN stock_picking_type spt
ON spt.warehouse_id = sl.warehouse_id
AND spt.code = 'outgoing'
WHERE sl.{legacy_is_a_dock}
"""
)


def set_dispatch_management(env):
"""Enable dispatch_management on picking types that need it,
matching stock_warehouse._get_picking_type_update_values defaults."""
env.cr.execute(
"""
UPDATE stock_picking_type spt
SET dispatch_management = TRUE
FROM stock_warehouse sw
WHERE spt.warehouse_id = sw.id
AND (
spt.code IN ('incoming', 'outgoing')
OR (sw.delivery_steps = 'pick_pack_ship' AND spt.id = sw.pack_type_id)
OR (sw.delivery_steps = 'pick_ship' AND spt.id = sw.pick_type_id)
)
"""
)
15 changes: 15 additions & 0 deletions openupgrade_scripts/scripts/stock_fleet/19.0.1.0/pre-migration.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Copyright 2026 Heliconia Solutions Pvt. Ltd.
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from openupgradelib import openupgrade

column_renames = {
"stock_location": [
("is_a_dock", None),
],
}


@openupgrade.migrate()
def migrate(env, version):
openupgrade.rename_columns(env.cr, column_renames)
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---Models in module 'stock_fleet'---

---Fields in module 'stock_fleet'---
stock_fleet / stock.location / is_a_dock (boolean) : DEL

# DONE: legacy value preserved in pre-migration, backfilled into dock_ids in post-migration

stock_fleet / stock.picking.batch / end_date (datetime) : now a function

# NOTHING TO DO: non-stored

stock_fleet / stock.picking.type / dispatch_management (boolean) : NEW

# DONE: set in post-migration per stock_warehouse's own defaults

stock_fleet / stock.picking.type / dock_ids (many2many) : NEW relation: stock.location, hasdefault: compute

# DONE: backfilled from legacy is_a_dock locations in post-migration

---XML records in module 'stock_fleet'---
NEW ir.ui.view: stock_fleet.view_picking_type_form
DEL ir.ui.view: stock_fleet.stock_location_tree_stock_fleet

# NOTHING TO DO
Loading