odoo-addon-openupgrade-scripts 18.0.1.0.0.79__py3-none-any.whl → 18.0.1.0.0.98__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. odoo/addons/openupgrade_scripts/apriori.py +1 -1
  2. odoo/addons/openupgrade_scripts/scripts/account/18.0.1.3/post-migration.py +1 -1
  3. odoo/addons/openupgrade_scripts/scripts/base_vat/18.0.1.0/upgrade_analysis_work.txt +5 -0
  4. odoo/addons/openupgrade_scripts/scripts/hr/18.0.1.1/post-migration.py +10 -0
  5. odoo/addons/openupgrade_scripts/scripts/hr/18.0.1.1/pre-migration.py +52 -0
  6. odoo/addons/openupgrade_scripts/scripts/hr/18.0.1.1/upgrade_analysis_work.txt +76 -0
  7. odoo/addons/openupgrade_scripts/scripts/l10n_es/18.0.5.4/upgrade_analysis_work.txt +76 -0
  8. odoo/addons/openupgrade_scripts/scripts/l10n_fr/18.0.2.1/pre-migration.py +687 -0
  9. odoo/addons/openupgrade_scripts/scripts/l10n_fr/18.0.2.1/upgrade_analysis_work.txt +384 -0
  10. odoo/addons/openupgrade_scripts/scripts/l10n_fr_account/18.0.2.2/post-migration.py +26 -0
  11. odoo/addons/openupgrade_scripts/scripts/l10n_fr_account/18.0.2.2/pre-migration.py +24 -0
  12. odoo/addons/openupgrade_scripts/scripts/l10n_fr_account/18.0.2.2/upgrade_analysis_work.txt +3185 -0
  13. odoo/addons/openupgrade_scripts/scripts/purchase/18.0.1.2/post-migration.py +28 -0
  14. odoo/addons/openupgrade_scripts/scripts/purchase/18.0.1.2/pre-migration.py +24 -0
  15. odoo/addons/openupgrade_scripts/scripts/purchase/18.0.1.2/upgrade_analysis_work.txt +51 -0
  16. odoo/addons/openupgrade_scripts/scripts/sale/18.0.1.2/end-migration.py +49 -0
  17. odoo/addons/openupgrade_scripts/scripts/sale/18.0.1.2/post-migration.py +21 -0
  18. odoo/addons/openupgrade_scripts/scripts/sale/18.0.1.2/pre-migration.py +34 -0
  19. odoo/addons/openupgrade_scripts/scripts/sale/18.0.1.2/upgrade_analysis_work.txt +85 -0
  20. odoo/addons/openupgrade_scripts/scripts/sale_crm/18.0.1.0/upgrade_analysis_work.txt +5 -0
  21. odoo/addons/openupgrade_scripts/scripts/sale_stock/18.0.1.0/post-migration.py +12 -0
  22. odoo/addons/openupgrade_scripts/scripts/sale_stock/18.0.1.0/pre-migration.py +62 -0
  23. odoo/addons/openupgrade_scripts/scripts/sale_stock/18.0.1.0/upgrade_analysis_work.txt +18 -0
  24. odoo/addons/openupgrade_scripts/scripts/stock/18.0.1.1/post-migration.py +99 -0
  25. odoo/addons/openupgrade_scripts/scripts/stock/18.0.1.1/pre-migration.py +81 -0
  26. odoo/addons/openupgrade_scripts/scripts/stock/18.0.1.1/upgrade_analysis_work.txt +139 -0
  27. odoo/addons/openupgrade_scripts/scripts/stock_account/18.0.1.1/end-migration.py +23 -0
  28. odoo/addons/openupgrade_scripts/scripts/stock_account/18.0.1.1/post-migration.py +36 -0
  29. odoo/addons/openupgrade_scripts/scripts/stock_account/18.0.1.1/pre-migration.py +22 -0
  30. odoo/addons/openupgrade_scripts/scripts/stock_account/18.0.1.1/upgrade_analysis_work.txt +34 -0
  31. {odoo_addon_openupgrade_scripts-18.0.1.0.0.79.dist-info → odoo_addon_openupgrade_scripts-18.0.1.0.0.98.dist-info}/METADATA +1 -1
  32. {odoo_addon_openupgrade_scripts-18.0.1.0.0.79.dist-info → odoo_addon_openupgrade_scripts-18.0.1.0.0.98.dist-info}/RECORD +34 -6
  33. {odoo_addon_openupgrade_scripts-18.0.1.0.0.79.dist-info → odoo_addon_openupgrade_scripts-18.0.1.0.0.98.dist-info}/WHEEL +0 -0
  34. {odoo_addon_openupgrade_scripts-18.0.1.0.0.79.dist-info → odoo_addon_openupgrade_scripts-18.0.1.0.0.98.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,28 @@
1
+ # Copyright 2025 ForgeFlow S.L. (https://www.forgeflow.com)
2
+ # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
3
+ from openupgradelib import openupgrade, openupgrade_180
4
+
5
+
6
+ def convert_company_dependent(env):
7
+ openupgrade_180.convert_company_dependent(
8
+ env, "res.partner", "property_purchase_currency_id"
9
+ )
10
+ openupgrade_180.convert_company_dependent(
11
+ env, "res.partner", "receipt_reminder_email"
12
+ )
13
+ openupgrade_180.convert_company_dependent(
14
+ env, "res.partner", "reminder_date_before_receipt"
15
+ )
16
+
17
+
18
+ @openupgrade.migrate()
19
+ def migrate(env, version):
20
+ convert_company_dependent(env)
21
+ openupgrade.load_data(env, "purchase", "18.0.1.2/noupdate_changes.xml")
22
+ openupgrade.delete_record_translations(
23
+ env.cr, "purchase", ["email_template_edi_purchase", "track_po_line_template"]
24
+ )
25
+ openupgrade.delete_records_safely_by_xml_id(
26
+ env,
27
+ ["purchase.receipt_reminder_email", "purchase.reminder_date_before_receipt"],
28
+ )
@@ -0,0 +1,24 @@
1
+ # Copyright 2025 ForgeFlow S.L. (https://www.forgeflow.com)
2
+ # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
3
+ from openupgradelib import openupgrade
4
+
5
+
6
+ def fill_purchase_order_amount_total_cc(env):
7
+ openupgrade.logged_query(
8
+ env.cr,
9
+ """
10
+ UPDATE purchase_order
11
+ SET amount_total_cc = amount_total / currency_rate
12
+ WHERE COALESCE(currency_rate, 0) != 0""",
13
+ )
14
+
15
+
16
+ @openupgrade.migrate()
17
+ def migrate(env, version):
18
+ openupgrade.delete_sql_constraint_safely(
19
+ env, "purchase", "purchase_order_line", "accountable_required_fields"
20
+ )
21
+ openupgrade.add_columns(
22
+ env, [("purchase.order", "amount_total_cc", "float", None, "purchase_order")]
23
+ )
24
+ fill_purchase_order_amount_total_cc(env)
@@ -0,0 +1,51 @@
1
+ ---Models in module 'purchase'---
2
+ new model bill.to.po.wizard [transient]
3
+ new model purchase.bill.line.match [sql_view]
4
+ # NOTHING TO DO
5
+
6
+ ---Fields in module 'purchase'---
7
+ purchase / account.move.line / is_downpayment (boolean) : previously in module sale
8
+ # NOTHING TO DO
9
+
10
+ purchase / purchase.order / amount_total_cc (float) : NEW isfunction: function, stored
11
+ # DONE: pre-migration: pre-create column and fill it (amount_total_cc = amount_total / currency_rate)
12
+
13
+ purchase / purchase.order / mail_reception_declined (boolean): NEW
14
+ # NOTHING TO DO: new feature
15
+
16
+ purchase / purchase.order.line / analytic_distribution_search (json): DEL stored: False
17
+ # NOTHING TO DO
18
+
19
+ purchase / purchase.order.line / is_downpayment (boolean) : NEW
20
+ purchase / purchase.order.line / product_no_variant_attribute_value_ids (many2many): previously in module purchase_product_matrix
21
+ purchase / purchase.order.line / product_template_attribute_value_ids (many2many): previously in module purchase_product_matrix
22
+ # NOTHING TO DO
23
+
24
+ purchase / res.partner / property_purchase_currency_id (many2one): needs conversion to v18-style company dependent
25
+ purchase / res.partner / receipt_reminder_email (boolean): needs conversion to v18-style company dependent
26
+ purchase / res.partner / reminder_date_before_receipt (integer): needs conversion to v18-style company dependent
27
+ # DONE: post-migration: used openupgrade_180.convert_company_dependent
28
+
29
+ ---XML records in module 'purchase'---
30
+ NEW ir.actions.server: purchase.action_confirm_rfqs
31
+ NEW ir.actions.server: purchase.action_merger
32
+ NEW ir.model.access: purchase.access_bill_to_po_wizard
33
+ NEW ir.model.access: purchase.access_purchase_bill_line_match
34
+ NEW ir.model.access: purchase.access_purchase_bill_line_match_invoicing_payments
35
+ NEW ir.model.access: purchase.access_purchase_bill_line_match_readonly
36
+ # NOTHING TO DO
37
+
38
+ ir.model.constraint: purchase.constraint_purchase_order_line_accountable_required_fields (changed definition: is now 'check(display_type is not null or is_downpayment or(product_id is not null and product_uom is not null and date_planned is not null))' ('check(display_type is not null or(product_id is not null and product_uom is not null and date_planned is not null))'))
39
+ # DONE: pre-migration: delete it (to safely force the change)
40
+
41
+ DEL ir.property: purchase.receipt_reminder_email (noupdate)
42
+ DEL ir.property: purchase.reminder_date_before_receipt (noupdate)
43
+ # DONE: post-migration: delete old property safely (now it's an ir.default record created by ORM)
44
+
45
+ NEW ir.ui.view: purchase.bill_to_po_wizard_form
46
+ NEW ir.ui.view: purchase.product_product_supplierinfo_tree_view2
47
+ NEW ir.ui.view: purchase.purchase_bill_line_match_tree
48
+ NEW ir.ui.view: purchase.purchase_history_graph
49
+ NEW ir.ui.view: purchase.purchase_history_pivot
50
+ DEL ir.ui.view: purchase.view_product_account_purchase_ok_form
51
+ NEW web_tour.tour: purchase.purchase_tour
@@ -0,0 +1,49 @@
1
+ # Copyright 2025 ForgeFlow S.L. (https://www.forgeflow.com)
2
+ # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
3
+ from openupgradelib import openupgrade
4
+
5
+
6
+ def _setup_property_downpayment_account(env):
7
+ # "Copy" of sale _setup_property_downpayment_account
8
+ for company in env.companies:
9
+ if not company.chart_template or env["product.category"].with_company(
10
+ company
11
+ ).search_count(
12
+ [("property_account_downpayment_categ_id", "!=", False)], limit=1
13
+ ):
14
+ continue
15
+ # begin patch: avoid having errors for not loading l10n modules
16
+ if not company.country_id.code:
17
+ continue
18
+ module_name = "l10n_" + company.country_id.code.lower()
19
+ l10n_module = env["ir.module.module"].search(
20
+ [
21
+ ("name", "=", module_name),
22
+ ("state", "=", "installed"),
23
+ ]
24
+ )
25
+ if not l10n_module:
26
+ continue
27
+ # end patch
28
+ template_data = (
29
+ env["account.chart.template"]
30
+ ._get_chart_template_data(company.chart_template)
31
+ .get("template_data")
32
+ )
33
+ if template_data and template_data.get("property_account_downpayment_categ_id"):
34
+ property_downpayment_account = env.ref(
35
+ f'account.{company.id}_{template_data["property_account_downpayment_categ_id"]}',
36
+ raise_if_not_found=False,
37
+ )
38
+ if property_downpayment_account:
39
+ env["ir.default"].set(
40
+ "product.category",
41
+ "property_account_downpayment_categ_id",
42
+ property_downpayment_account.id,
43
+ company_id=company.id,
44
+ )
45
+
46
+
47
+ @openupgrade.migrate()
48
+ def migrate(env, version):
49
+ _setup_property_downpayment_account(env)
@@ -0,0 +1,21 @@
1
+ # Copyright 2025 ForgeFlow S.L. (https://www.forgeflow.com)
2
+ # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
3
+ from openupgradelib import openupgrade
4
+
5
+
6
+ @openupgrade.migrate()
7
+ def migrate(env, version):
8
+ openupgrade.load_data(env, "sale", "18.0.1.2/noupdate_changes.xml")
9
+ openupgrade.delete_record_translations(
10
+ env.cr, "sale", ["email_template_edi_sale", "mail_template_sale_confirmation"]
11
+ )
12
+ openupgrade.delete_records_safely_by_xml_id(
13
+ env,
14
+ [
15
+ "sale.account_invoice_send_rule_see_all",
16
+ "sale.account_invoice_send_rule_see_personal",
17
+ "sale.onboarding_onboarding_step_sale_order_confirmation",
18
+ "sale.onboarding_onboarding_step_sample_quotation",
19
+ "sale.onboarding_onboarding_sale_quotation",
20
+ ],
21
+ )
@@ -0,0 +1,34 @@
1
+ # Copyright 2025 ForgeFlow S.L. (https://www.forgeflow.com)
2
+ # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
3
+ from openupgradelib import openupgrade
4
+
5
+
6
+ @openupgrade.migrate()
7
+ def migrate(env, version):
8
+ openupgrade.rename_fields(
9
+ env,
10
+ [("product.document", "product_document", "attached_on", "attached_on_sale")],
11
+ )
12
+ openupgrade.rename_xmlids(
13
+ env.cr,
14
+ [
15
+ (
16
+ "sale.sale_order_action_view_quotation_kanban",
17
+ "sale.action_quotations_kanban",
18
+ )
19
+ ],
20
+ )
21
+ openupgrade.add_columns(
22
+ env,
23
+ [("sale.order.line", "technical_price_unit", "float", None, "sale_order_line")],
24
+ )
25
+ openupgrade.logged_query(
26
+ env.cr,
27
+ """
28
+ UPDATE sale_order_line
29
+ SET technical_price_unit = price_unit
30
+ """,
31
+ )
32
+ openupgrade.delete_sql_constraint_safely(
33
+ env, "sale", "sale_order_line", "accountable_required_fields"
34
+ )
@@ -0,0 +1,85 @@
1
+ ---Models in module 'sale'---
2
+ ---Fields in module 'sale'---
3
+ sale / account.analytic.applicability / business_domain (False) : selection_keys is now '['bill', 'expense', 'general', 'invoice', 'manufacturing_order', 'purchase_order', 'sale_order', 'stock_picking', 'timesheet']' ('['bill', 'expense', 'general', 'invoice', 'manufacturing_order', 'purchase_order', 'sale_order']')
4
+ # NOTHING TO DO: new options 'stock_picking' and 'timesheet'
5
+
6
+ sale / account.move.line / is_downpayment (boolean) : module is now 'purchase' ('sale')
7
+ # NOTHING TO DO
8
+
9
+ sale / product.category / property_account_downpayment_categ_id (many2one): NEW relation: account.account
10
+ # DONE: end-migration: call _setup_property_downpayment_account
11
+
12
+ sale / product.document / attached_on (selection) : DEL selection_keys: ['quotation', 'sale_order']
13
+ sale / product.document / attached_on_sale (selection) : NEW required, selection_keys: ['hidden', 'quotation', 'sale_order'], hasdefault: default
14
+ # DONE: pre-migration: renamed field
15
+
16
+ sale / res.company / sale_down_payment_product_id (many2one): DEL relation: product.product
17
+ # NOTHING TO DO: it was unused. Now downpayments use property_account_downpayment_categ_id
18
+
19
+ sale / sale.order / amount_to_invoice (float) : not stored anymore
20
+ sale / sale.order / analytic_account_id (many2one): DEL relation: account.analytic.account
21
+
22
+ sale / sale.order.line / analytic_distribution_search (json): DEL stored: False
23
+ # NOTHING TO DO
24
+
25
+ sale / sale.order.line / qty_invoiced_posted (float) : previously in module l10n_it_edi_doi
26
+ l10n_it_edi_doi / sale.order.line / qty_invoiced_posted (float) : not stored anymore
27
+ # NOTHING TO DO
28
+
29
+ sale / sale.order.line / combo_item_id (many2one) : NEW relation: product.combo.item
30
+ sale / sale.order.line / linked_line_id (many2one) : previously in module website_sale
31
+ sale / sale.order.line / linked_line_ids (one2many) : NEW relation: sale.order.line
32
+ sale / sale.order.line / linked_virtual_id (char) : NEW
33
+ sale / sale.order.line / selected_combo_items (char) : NEW stored: False
34
+ sale / sale.order.line / virtual_id (char) : NEW
35
+ # NOTHING TO DO
36
+
37
+ sale / sale.order.line / technical_price_unit (float) : NEW
38
+ # DONE: pre-migration: technical field filled with price_unit
39
+
40
+ ---XML records in module 'sale'---
41
+ NEW ir.actions.act_window.view: sale.action_quotations_kanban
42
+ NEW ir.actions.act_window.view: sale.action_quotations_tree
43
+ NEW ir.actions.server: sale.model_sale_order_send_mail
44
+ NEW ir.model.access: sale.access_account_move_send_batch_wizard_salesman
45
+ NEW ir.model.access: sale.access_account_move_send_wizard_salesman
46
+ NEW ir.model.access: sale.access_update_product_attribute_value_sale_manager
47
+ DEL ir.model.access: sale.access_account_move_send_salesman
48
+ # NOTHING TO DO
49
+
50
+ ir.model.constraint: sale.constraint_sale_order_line_accountable_required_fields (changed definition: is now 'check(display_type is not null or is_downpayment or(product_id is not null and product_uom is not null))' ('check(display_type is not null or(product_id is not null and product_uom is not null))'))
51
+ # DONE: pre-migration: delete it to force the change
52
+
53
+ NEW ir.rule: sale.account_invoice_send_batch_rule_see_all (noupdate)
54
+ NEW ir.rule: sale.account_invoice_send_batch_rule_see_personal (noupdate)
55
+ NEW ir.rule: sale.account_invoice_send_single_rule_see_all (noupdate)
56
+ NEW ir.rule: sale.account_invoice_send_single_rule_see_personal (noupdate)
57
+ DEL ir.rule: sale.account_invoice_send_rule_see_all (noupdate)
58
+ DEL ir.rule: sale.account_invoice_send_rule_see_personal (noupdate)
59
+ # DONE: post-migration: safely delete (we could rename them in pre-migration too, but then we would need to change the field name)
60
+
61
+ NEW ir.ui.menu: sale.menu_product_combos
62
+ NEW ir.ui.menu: sale.menu_product_tags
63
+ NEW ir.ui.menu: sale.sale_menu_config_activities
64
+ NEW ir.ui.view: sale.product_template_view_form
65
+ NEW ir.ui.view: sale.quote_document_layout_preview
66
+ NEW ir.ui.view: sale.sale_order_kanban_upload
67
+ NEW ir.ui.view: sale.sale_order_list_upload
68
+ NEW ir.ui.view: sale.view_category_property_form
69
+ NEW ir.ui.view: sale.view_quotation_kanban_with_onboarding
70
+ DEL ir.ui.view: sale_product_configurator.product_template_view_form
71
+ DEL ir.ui.view: sale_product_configurator.sale_order_view_form
72
+ NEW mail.message.subtype: sale.mt_order_viewed (noupdate)
73
+ NEW mail.message.subtype: sale.mt_salesteam_order_viewed (noupdate)
74
+ # NOTHING TO DO
75
+
76
+ DEL onboarding.onboarding: sale.onboarding_onboarding_sale_quotation (noupdate)
77
+ DEL onboarding.onboarding.step: sale.onboarding_onboarding_step_sale_order_confirmation (noupdate)
78
+ DEL onboarding.onboarding.step: sale.onboarding_onboarding_step_sample_quotation (noupdate)
79
+ # DONE: post-migration: safely delete
80
+
81
+ NEW res.groups: sale.group_discount_per_so_line [renamed from product module]
82
+ # NOTHING TO DO: rename done in product module
83
+
84
+ NEW web_tour.tour: sale.sale_tour
85
+ # NOTHING TO DO
@@ -0,0 +1,5 @@
1
+ ---Models in module 'sale_crm'---
2
+ ---Fields in module 'sale_crm'---
3
+ ---XML records in module 'sale_crm'---
4
+ ---nothing has changed in this module--
5
+ # NOTHING TO DO
@@ -0,0 +1,12 @@
1
+ # Copyright 2025 ForgeFlow S.L. (https://www.forgeflow.com)
2
+ # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
3
+ from openupgradelib import openupgrade, openupgrade_180
4
+
5
+
6
+ def convert_company_dependent(env):
7
+ openupgrade_180.convert_company_dependent(env, "res.users", "property_warehouse_id")
8
+
9
+
10
+ @openupgrade.migrate()
11
+ def migrate(env, version):
12
+ convert_company_dependent(env)
@@ -0,0 +1,62 @@
1
+ # Copyright 2025 ForgeFlow S.L. (https://www.forgeflow.com)
2
+ # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
3
+ from openupgradelib import openupgrade
4
+
5
+ _new_columns = [
6
+ ("sale.order.line", "warehouse_id", "many2one"),
7
+ ]
8
+
9
+
10
+ def fill_sale_order_line_warehouse_id(env):
11
+ openupgrade.logged_query(
12
+ env.cr,
13
+ """
14
+ UPDATE sale_order_line sol
15
+ SET warehouse_id = so.warehouse_id
16
+ FROM sale_order so
17
+ WHERE sol.order_id = so.id AND sol.route_id IS NULL
18
+ """,
19
+ )
20
+ openupgrade.logged_query(
21
+ env.cr,
22
+ """
23
+ WITH sub as (
24
+ SELECT sr.route_id, sr.location_dest_id, sl.warehouse_id
25
+ FROM stock_rule sr
26
+ JOIN stock_route slr ON sr.route_id = slr.id
27
+ LEFT JOIN stock_location sl ON sr.location_src_id = sl.id
28
+ WHERE sr.action != 'push'
29
+ ORDER BY sr.route_sequence, sr.sequence
30
+ )
31
+ UPDATE sale_order_line sol2
32
+ SET warehouse_id = COALESCE(
33
+ sub1.warehouse_id, sub2.warehouse_id, so.warehouse_id)
34
+ FROM sale_order_line sol
35
+ JOIN sale_order so ON sol.order_id = so.id
36
+ LEFT JOIN res_partner rp ON so.partner_shipping_id = rp.id
37
+ LEFT JOIN stock_location sl ON sl.id = (
38
+ rp.property_stock_customer::jsonb -> so.company_id)::int4
39
+ LEFT JOIN LATERAL (
40
+ SELECT sub.warehouse_id
41
+ FROM sub
42
+ WHERE sol.route_id = sub.route_id AND
43
+ sub.location_dest_id = sl.id AND (
44
+ sub.warehouse_id IS NULL OR so.warehouse_id = sub.warehouse_id)
45
+ LIMIT 1
46
+ ) sub1 ON TRUE
47
+ LEFT JOIN LATERAL (
48
+ SELECT sub.warehouse_id
49
+ FROM sub
50
+ WHERE sol.route_id = sub.route_id AND
51
+ sub.location_dest_id = sl.id
52
+ LIMIT 1
53
+ ) sub2 ON TRUE
54
+ WHERE sol.id = sol2.id AND sol.route_id IS NOT NULL
55
+ """,
56
+ )
57
+
58
+
59
+ @openupgrade.migrate()
60
+ def migrate(env, version=None):
61
+ openupgrade.add_columns(env, _new_columns)
62
+ fill_sale_order_line_warehouse_id(env)
@@ -0,0 +1,18 @@
1
+ ---Models in module 'sale_stock'---
2
+ ---Fields in module 'sale_stock'---
3
+ sale_stock / res.users / property_warehouse_id (many2one): needs conversion to v18-style company dependent
4
+ # DONE: post-migration: used openupgrade_180.convert_company_dependent
5
+
6
+ sale_stock / sale.order.line / warehouse_id (many2one) : is now stored
7
+ sale_stock / sale.order.line / warehouse_id (many2one) : not related anymore
8
+ sale_stock / sale.order.line / warehouse_id (many2one) : now a function
9
+ # DONE: pre-migration: pre-create and fill
10
+
11
+ sale_stock / stock.picking / sale_id (many2one) : not related anymore
12
+ sale_stock / stock.picking / sale_id (many2one) : now a function
13
+ # NOTHING TO DO
14
+
15
+ ---XML records in module 'sale_stock'---
16
+ NEW ir.ui.view: sale_stock.sale_stock_help_message_template
17
+ NEW ir.ui.view: sale_stock.view_picking_form
18
+ # NOTHING TO DO
@@ -0,0 +1,99 @@
1
+ # Copyright 2025 ForgeFlow S.L. (https://www.forgeflow.com)
2
+ # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
3
+ from openupgradelib import openupgrade, openupgrade_180
4
+
5
+
6
+ def convert_company_dependent(env):
7
+ openupgrade_180.convert_company_dependent(
8
+ env, "product.template", "property_stock_inventory"
9
+ )
10
+ openupgrade_180.convert_company_dependent(
11
+ env, "product.template", "property_stock_production"
12
+ )
13
+ openupgrade_180.convert_company_dependent(env, "product.template", "responsible_id")
14
+ openupgrade_180.convert_company_dependent(
15
+ env, "res.partner", "property_stock_customer"
16
+ )
17
+ openupgrade_180.convert_company_dependent(
18
+ env, "res.partner", "property_stock_supplier"
19
+ )
20
+
21
+
22
+ def _create_default_new_types_for_all_warehouses(env):
23
+ # method mainly based on _create_or_update_sequences_and_picking_types()
24
+ all_warehouses = env["stock.warehouse"].with_context(active_test=False).search([])
25
+ for wh in all_warehouses:
26
+ sequence_data = wh._get_sequence_values()
27
+ for field in ["qc_type_id", "store_type_id", "xdock_type_id"]:
28
+ # choose the next available color for the operation types of this warehouse
29
+ all_used_colors = [
30
+ res["color"]
31
+ for res in env["stock.picking.type"]
32
+ .with_context(active_test=False)
33
+ .search_read(
34
+ [("warehouse_id", "!=", False), ("color", "!=", False)],
35
+ ["color"],
36
+ order="color",
37
+ )
38
+ ]
39
+ available_colors = [
40
+ zef for zef in range(0, 12) if zef not in all_used_colors
41
+ ]
42
+ color = available_colors[0] if available_colors else 0
43
+ # suit for each warehouse: reception, internal, pick, pack, ship
44
+ max_sequence = (
45
+ env["stock.picking.type"]
46
+ .with_context(active_test=False)
47
+ .search_read(
48
+ [("sequence", "!=", False)],
49
+ ["sequence"],
50
+ limit=1,
51
+ order="sequence desc",
52
+ )
53
+ )
54
+ max_sequence = max_sequence and max_sequence[0]["sequence"] or 0
55
+ values = wh._get_picking_type_update_values()[field]
56
+ create_data, _ = wh._get_picking_type_create_values(max_sequence)
57
+ values.update(create_data[field])
58
+ sequence = env["ir.sequence"].create(sequence_data[field])
59
+ values.update(
60
+ warehouse_id=wh.id,
61
+ color=color,
62
+ sequence_id=sequence.id,
63
+ sequence=max_sequence + 1,
64
+ company_id=wh.company_id.id,
65
+ active=wh.active,
66
+ )
67
+ # create picking type
68
+ picking_type_id = env["stock.picking.type"].create(values).id
69
+ # update picking type for warehouse
70
+ wh.write({field: picking_type_id})
71
+
72
+
73
+ def _set_inter_company_locations(env):
74
+ """See https://github.com/odoo/odoo/commit/08536d687880ca6d9ad5c37b639c0ad4c2599d74"""
75
+ companies = env["res.company"].search([])
76
+ if len(companies) > 1:
77
+ inter_company_location = env.ref("stock.stock_location_inter_company")
78
+ inactive = False
79
+ if not inter_company_location.active:
80
+ inactive = True
81
+ inter_company_location.sudo().write({"active": True})
82
+ for company in companies:
83
+ company.sudo()._set_per_company_inter_company_locations(
84
+ inter_company_location
85
+ )
86
+ if inactive:
87
+ # we leave everything as it was
88
+ inter_company_location.sudo().write({"active": False})
89
+
90
+
91
+ @openupgrade.migrate()
92
+ def migrate(env, version):
93
+ convert_company_dependent(env)
94
+ _create_default_new_types_for_all_warehouses(env)
95
+ _set_inter_company_locations(env)
96
+ openupgrade.load_data(env, "stock", "18.0.1.1/noupdate_changes.xml")
97
+ openupgrade.delete_records_safely_by_xml_id(
98
+ env, ["stock.property_stock_customer", "stock.property_stock_supplier"]
99
+ )
@@ -0,0 +1,81 @@
1
+ # Copyright 2025 ForgeFlow S.L. (https://www.forgeflow.com)
2
+ # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
3
+ from openupgradelib import openupgrade
4
+
5
+ _field_renames = [
6
+ ("stock.move", "stock_move", "location_dest_id", "location_final_id"),
7
+ (
8
+ "stock.warehouse.orderpoint",
9
+ "stock_warehouse_orderpoint",
10
+ "qty_to_order",
11
+ "qty_to_order_manual",
12
+ ),
13
+ ]
14
+
15
+ _xmlid_renames = [
16
+ ("stock.stock_location_inter_wh", "stock.stock_location_inter_company"),
17
+ ]
18
+
19
+ _new_columns = [
20
+ ("product.template", "is_storable", "boolean", False),
21
+ ("stock.move", "location_dest_id", "many2one"),
22
+ ("stock.rule", "location_dest_from_rule", "boolean", False),
23
+ ("stock.picking.type", "move_type", "selection", "direct"),
24
+ ("stock.putaway.rule", "sublocation", "selection", "no"),
25
+ ]
26
+
27
+
28
+ def fill_product_template_is_storable(env):
29
+ openupgrade.logged_query(
30
+ env.cr,
31
+ """
32
+ UPDATE product_template
33
+ SET is_storable = TRUE, type = 'consu'
34
+ WHERE type = 'product'""",
35
+ )
36
+
37
+
38
+ def fill_stock_move_location_dest_id(env):
39
+ openupgrade.logged_query(
40
+ env.cr,
41
+ """
42
+ UPDATE stock_move sm2
43
+ SET location_dest_id = COALESCE(sp.location_dest_id,
44
+ spt.default_location_dest_id, sm.location_final_id)
45
+ FROM stock_move sm
46
+ LEFT JOIN stock_picking sp ON sm.picking_id = sp.id
47
+ LEFT JOIN stock_picking_type spt ON sm.picking_type_id = spt.id
48
+ WHERE sm2.id = sm.id
49
+ """,
50
+ )
51
+ openupgrade.logged_query(
52
+ env.cr,
53
+ """
54
+ UPDATE stock_rule sr
55
+ SET location_dest_from_rule = TRUE
56
+ FROM stock_move sm
57
+ WHERE sm.rule_id = sr.id
58
+ AND sm.location_dest_id != sm.location_final_id
59
+ AND sr.action IN ('pull', 'pull_push')
60
+ """,
61
+ )
62
+
63
+
64
+ def fill_stock_putaway_rule_sublocation(env):
65
+ openupgrade.logged_query(
66
+ env.cr,
67
+ """
68
+ UPDATE stock_putaway_rule
69
+ SET sublocation = 'closest_location'
70
+ WHERE storage_category_id is not null""",
71
+ )
72
+
73
+
74
+ @openupgrade.migrate()
75
+ def migrate(env, version=None):
76
+ openupgrade.rename_fields(env, _field_renames)
77
+ openupgrade.rename_xmlids(env.cr, _xmlid_renames)
78
+ openupgrade.add_columns(env, _new_columns)
79
+ fill_product_template_is_storable(env)
80
+ fill_stock_move_location_dest_id(env)
81
+ fill_stock_putaway_rule_sublocation(env)