Skip to content
Closed
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/modules170-180.rst
Original file line number Diff line number Diff line change
Expand Up @@ -922,7 +922,7 @@ Module coverage 17.0 -> 18.0
+---------------------------------------------------+----------------------+-------------------------------------------------+
| |new| resource_mail | |No DB layout changes. |
+---------------------------------------------------+----------------------+-------------------------------------------------+
| sale | | |
| sale |Done | |
+---------------------------------------------------+----------------------+-------------------------------------------------+
| sale_async_emails | |No DB layout changes. |
+---------------------------------------------------+----------------------+-------------------------------------------------+
Expand Down
49 changes: 49 additions & 0 deletions openupgrade_scripts/scripts/sale/18.0.1.2/pre-migration.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
from openupgradelib import openupgrade


def remove_obsolete_sale_order_kanban_view(env):
"""
Remove the outdated kanban view entry for 'action_quotations' (Odoo 17)
to prevent duplicate key constraint violation during migration to Odoo 18.
Comment on lines +6 to +7
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't remove it. the problem is caused by the view entry with this xmlid being attached to action_quotations in v17 and to action_quotations_with_onboarding in v18.

So I think the correct solution is to rename the xmlid sale.sale_order_action_view_quotation_kanban to sale.action_quotations_kanban

"""
openupgrade.logged_query(
env.cr,
"""
SELECT v.id
FROM ir_act_window_view v
JOIN ir_model_data d ON d.res_id = v.id
AND d.model = 'ir.actions.act_window.view'
WHERE d.module = 'sale'
AND d.name = 'sale_order_action_view_quotation_kanban'
""",
)
result = env.cr.fetchone()

if result:
view_id = result[0]
openupgrade.logged_query(
env.cr, "DELETE FROM ir_act_window_view WHERE id = %s", (view_id,)
)
openupgrade.logged_query(
env.cr,
"""
DELETE FROM ir_model_data
WHERE model = 'ir.actions.act_window.view'
AND module = 'sale'
AND name = 'sale_order_action_view_quotation_kanban'
""",
)


_xmlids_renames = [
(
"product.group_discount_per_so_line",
"sale.group_discount_per_so_line",
),
]


@openupgrade.migrate()
def migrate(env, version):
remove_obsolete_sale_order_kanban_view(env)
openupgrade.rename_xmlids(env.cr, _xmlids_renames)
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
---Models in module 'sale'---
---Fields in module 'sale'---
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']')
sale / account.move.line / is_downpayment (boolean) : module is now 'purchase' ('sale')
sale / product.category / property_account_downpayment_categ_id (many2one): NEW relation: account.account
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

set this per company from the account of sale_down_payment_product_id below with the standard fallbacks to category of company's income account

sale / product.document / attached_on (selection) : DEL selection_keys: ['quotation', 'sale_order']
sale / product.document / attached_on_sale (selection) : NEW required, selection_keys: ['hidden', 'quotation', 'sale_order'], hasdefault: default
Comment on lines +6 to +7
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you need to set attached_on_sale from attached_on

sale / res.company / sale_down_payment_product_id (many2one): DEL relation: product.product
sale / sale.order / amount_to_invoice (float) : not stored anymore
sale / sale.order / analytic_account_id (many2one): DEL relation: account.analytic.account
sale / sale.order.line / analytic_distribution_search (json): DEL
sale / sale.order.line / combo_item_id (many2one) : NEW relation: product.combo.item
sale / sale.order.line / linked_line_id (many2one) : previously in module website_sale
sale / sale.order.line / linked_line_ids (one2many) : NEW relation: sale.order.line
sale / sale.order.line / linked_virtual_id (char) : NEW
sale / sale.order.line / qty_invoiced_posted (float) : previously in module l10n_it_edi_doi
sale / sale.order.line / selected_combo_items (char) : NEW
sale / sale.order.line / technical_price_unit (float) : NEW
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this column should be precreated and filled with the value of price_unit (cf https://github.com/odoo/odoo/blob/18.0/addons/sale/models/sale_order_line.py#L574)

sale / sale.order.line / virtual_id (char) : NEW
---XML records in module 'sale'---
NEW ir.actions.act_window.view: sale.action_quotations_kanban
NEW ir.actions.act_window.view: sale.action_quotations_tree
NEW ir.actions.server: sale.model_sale_order_send_mail
NEW ir.model.access: sale.access_account_move_send_batch_wizard_salesman
NEW ir.model.access: sale.access_account_move_send_wizard_salesman
NEW ir.model.access: sale.access_update_product_attribute_value_sale_manager
DEL ir.model.access: sale.access_account_move_send_salesman
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))'))
NEW ir.rule: sale.account_invoice_send_batch_rule_see_all (noupdate)
NEW ir.rule: sale.account_invoice_send_batch_rule_see_personal (noupdate)
NEW ir.rule: sale.account_invoice_send_single_rule_see_all (noupdate)
NEW ir.rule: sale.account_invoice_send_single_rule_see_personal (noupdate)
DEL ir.rule: sale.account_invoice_send_rule_see_all (noupdate)
DEL ir.rule: sale.account_invoice_send_rule_see_personal (noupdate)
NEW ir.ui.menu: sale.menu_product_combos
NEW ir.ui.menu: sale.menu_product_tags
NEW ir.ui.menu: sale.sale_menu_config_activities
NEW ir.ui.view: sale.product_template_view_form
NEW ir.ui.view: sale.quote_document_layout_preview
NEW ir.ui.view: sale.sale_order_kanban_upload
NEW ir.ui.view: sale.sale_order_list_upload
NEW ir.ui.view: sale.view_category_property_form
NEW ir.ui.view: sale.view_quotation_kanban_with_onboarding
DEL ir.ui.view: sale_product_configurator.product_template_view_form
DEL ir.ui.view: sale_product_configurator.sale_order_view_form
NEW mail.message.subtype: sale.mt_order_viewed (noupdate)
NEW mail.message.subtype: sale.mt_salesteam_order_viewed (noupdate)
DEL onboarding.onboarding: sale.onboarding_onboarding_sale_quotation (noupdate)
DEL onboarding.onboarding.step: sale.onboarding_onboarding_step_sale_order_confirmation (noupdate)
DEL onboarding.onboarding.step: sale.onboarding_onboarding_step_sample_quotation (noupdate)
NEW res.groups: sale.group_discount_per_so_line [renamed from product module]
NEW web_tour.tour: sale.sale_tour

# NOTHING TO DO
Loading