Skip to content

Commit bd45b0d

Browse files
committed
[OU-IMP] delivery: Refine migration scripts + work
1 parent 3782aee commit bd45b0d

File tree

2 files changed

+24
-5
lines changed

2 files changed

+24
-5
lines changed

addons/delivery/migrations/13.0.1.0/openupgrade_analysis_work.txt

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,23 @@ new model choose.delivery.carrier [transient]
44

55
---Fields in module 'delivery'---
66
delivery / delivery.carrier / get_return_label_from_portal (boolean): NEW
7+
delivery / delivery.carrier / return_label_on_delivery (boolean): NEW
8+
# NOTHING TO DO: New feature for allowing to print the return label. Default False value is OK for preserving previous behavior (no return label).
9+
710
delivery / delivery.carrier / invoice_policy (selection) : NEW required, selection_keys: ['estimated', 'real'], req_default: function, hasdefault
11+
# DONE: post-migration: Fill all delivery.carrier records to have `real` value in invoice_policy, as this is the most similar one to the v12 behavior
12+
813
delivery / delivery.carrier / margin (integer) : type is now 'float' ('integer')
9-
delivery / delivery.carrier / return_label_on_delivery (boolean): NEW
14+
# NOTHING TO DO: ORM/PG does the switch automatically
15+
1016
delivery / sale.order / delivery_price (float) : DEL
17+
# NOTHING TO DO: There's no carrier selection now in sale.order, only via wizard, so no computed price is shown in header
18+
1119
delivery / sale.order / invoice_shipping_on_delivery (boolean): DEL
12-
# NOTHING TO DO
20+
# NOTHING TO DO: The control for adding delivery line on picking is done with delivery.carrier.invoice_policy
1321

1422
delivery / sale.order / recompute_delivery_price (boolean): NEW
15-
# DONE: post-migration: marked as True if it has carrier
23+
# DONE: post-migration: marked as True if it has carrier and still quotation, for having the button "Update shipping cost" as highlighted
1624

1725
---XML records in module 'delivery'---
1826
NEW ir.ui.view: delivery.choose_delivery_carrier_view_form
@@ -21,7 +29,7 @@ NEW ir.ui.view: delivery.sale_order_portal_content_inherit_sale_stock_inherit_we
2129
NEW ir.ui.view: delivery.vpicktree_view_tree
2230
DEL ir.ui.view: delivery.assets_backend
2331
DEL ir.ui.view: delivery_hs_code.product_template_hs_code
24-
# NOTHING TO DO
32+
# NOTHING TO DO: noupdate="0" records
2533

2634
DEL mail.template: delivery.mail_template_data_delivery_confirmation [renamed to stock module] (noupdate)
2735
# NOTHING TO DO: handled in stock

addons/delivery/migrations/13.0.1.0/post-migration.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,28 @@
33
from openupgradelib import openupgrade
44

55

6+
def fill_delivery_carrier_invoice_policy(env):
7+
"""Fill all delivery.carrier records to have `real` value in invoice_policy,
8+
as this is the most similar one to the v12 behavior.
9+
"""
10+
openupgrade.logged_query(
11+
env.cr, "UPDATE delivery_carrier SET invoice_policy = 'real'"
12+
)
13+
14+
615
def fill_sale_order_recompute_delivery_price(env):
716
openupgrade.logged_query(
817
env.cr, """
918
UPDATE sale_order
1019
SET recompute_delivery_price = TRUE
11-
WHERE carrier_id IS NOT NULL"""
20+
WHERE carrier_id IS NOT NULL
21+
AND state IN ('draft', 'sent')"""
1222
)
1323

1424

1525
@openupgrade.migrate()
1626
def migrate(env, version):
27+
fill_delivery_carrier_invoice_policy(env)
1728
fill_sale_order_recompute_delivery_price(env)
1829
openupgrade.load_data(
1930
env.cr, "delivery", "migrations/13.0.1.0/noupdate_changes.xml")

0 commit comments

Comments
 (0)