Skip to content

Commit

Permalink
[MIG] delivery
Browse files Browse the repository at this point in the history
  • Loading branch information
MiquelRForgeFlow committed Aug 4, 2020
1 parent dd2f051 commit 3daf597
Show file tree
Hide file tree
Showing 5 changed files with 63 additions and 2 deletions.
2 changes: 1 addition & 1 deletion addons/delivery/migrations/13.0.1.0/noupdate_changes.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version='1.0' encoding='utf-8'?>
<odoo>
<record id="delivery_carrier_comp_rule" model="ir.rule">
<field name="active"/>
<field name="active" eval="True"/>
<field name="domain_force"> ['|', ('company_id', 'in', company_ids), ('company_id', '=', False)]</field>
</record>
</odoo>
27 changes: 27 additions & 0 deletions addons/delivery/migrations/13.0.1.0/openupgrade_analysis_work.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---Models in module 'delivery'---
new model choose.delivery.carrier [transient]
# NOTHING TO DO

---Fields in module 'delivery'---
delivery / delivery.carrier / get_return_label_from_portal (boolean): NEW
delivery / delivery.carrier / invoice_policy (selection) : NEW required, selection_keys: ['estimated', 'real'], req_default: function, hasdefault
delivery / delivery.carrier / margin (integer) : type is now 'float' ('integer')
delivery / delivery.carrier / return_label_on_delivery (boolean): NEW
delivery / sale.order / delivery_price (float) : DEL
delivery / sale.order / invoice_shipping_on_delivery (boolean): DEL
# NOTHING TO DO

delivery / sale.order / recompute_delivery_price (boolean): NEW
# DONE: post-migration: marked as True if it has carrier

---XML records in module 'delivery'---
NEW ir.ui.view: delivery.choose_delivery_carrier_view_form
NEW ir.ui.view: delivery.product_template_hs_code
NEW ir.ui.view: delivery.sale_order_portal_content_inherit_sale_stock_inherit_website_sale_delivery
NEW ir.ui.view: delivery.vpicktree_view_tree
DEL ir.ui.view: delivery.assets_backend
DEL ir.ui.view: delivery_hs_code.product_template_hs_code
# NOTHING TO DO

DEL mail.template: delivery.mail_template_data_delivery_confirmation [renamed to stock module] (noupdate)
# NOTHING TO DO: handled in stock
19 changes: 19 additions & 0 deletions addons/delivery/migrations/13.0.1.0/post-migration.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Copyright 2020 ForgeFlow <http://www.forgeflow.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from openupgradelib import openupgrade


def fill_sale_order_recompute_delivery_price(env):
openupgrade.logged_query(
env.cr, """
UPDATE sale_order
SET recompute_delivery_price = TRUE
WHERE carrier_id IS NOT NULL"""
)


@openupgrade.migrate()
def migrate(env, version):
fill_sale_order_recompute_delivery_price(env)
openupgrade.load_data(
env.cr, "delivery", "migrations/13.0.1.0/noupdate_changes.xml")
15 changes: 15 additions & 0 deletions addons/delivery/migrations/13.0.1.0/pre-migration.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Copyright 2020 ForgeFlow <http://www.forgeflow.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from openupgradelib import openupgrade


_column_renames = {
'sale_order': [
('delivery_price', None), # save value just in case
],
}


@openupgrade.migrate()
def migrate(env, version):
openupgrade.rename_columns(env.cr, _column_renames)
2 changes: 1 addition & 1 deletion odoo/openupgrade/doc/source/modules120-130.rst
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ missing in the new release are marked with |del|.
+----------------------------------------------+-------------------------------------------------+
| |del| decimal_precision | |
+----------------------------------------------+-------------------------------------------------+
|delivery | |
|delivery | Done |
+----------------------------------------------+-------------------------------------------------+
| |del| delivery_hs_code | |
+----------------------------------------------+-------------------------------------------------+
Expand Down

0 comments on commit 3daf597

Please sign in to comment.