diff --git a/docsource/modules130-140.rst b/docsource/modules130-140.rst
index de3a3c0fe6b2..f74063f64087 100644
--- a/docsource/modules130-140.rst
+++ b/docsource/modules130-140.rst
@@ -584,7 +584,7 @@ Module coverage 13.0 -> 14.0
+--------------------------------------------+-------------------------------------------------+
|resource | Nothing to do |
+--------------------------------------------+-------------------------------------------------+
-|sale | |
+|sale | Done |
+--------------------------------------------+-------------------------------------------------+
|sale_coupon | |
+--------------------------------------------+-------------------------------------------------+
diff --git a/openupgrade_scripts/scripts/sale/14.0.1.1/noupdate_changes.xml b/openupgrade_scripts/scripts/sale/14.0.1.1/noupdate_changes.xml
index a3589f0e4de2..630ac5619567 100644
--- a/openupgrade_scripts/scripts/sale/14.0.1.1/noupdate_changes.xml
+++ b/openupgrade_scripts/scripts/sale/14.0.1.1/noupdate_changes.xml
@@ -109,13 +109,27 @@
-
+
+
+
+
+
+ [('move_type', 'in', ('out_invoice', 'out_refund'))]
+
+
+ Personal Invoices
+ [('move_type', 'in', ('out_invoice', 'out_refund')), '|', ('invoice_user_id', '=', user.id), ('invoice_user_id', '=', False)]
+
+
+ [('move_id.move_type', 'in', ('out_invoice', 'out_refund'))]
+
+
+ [('move_id.move_type', 'in', ('out_invoice', 'out_refund')), '|', ('move_id.invoice_user_id', '=', user.id), ('move_id.invoice_user_id', '=', False)]
diff --git a/openupgrade_scripts/scripts/sale/14.0.1.1/post-migration.py b/openupgrade_scripts/scripts/sale/14.0.1.1/post-migration.py
new file mode 100644
index 000000000000..4029052e3f25
--- /dev/null
+++ b/openupgrade_scripts/scripts/sale/14.0.1.1/post-migration.py
@@ -0,0 +1,16 @@
+# Copyright 2021 ForgeFlow S.L.
+# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
+from openupgradelib import openupgrade
+
+
+@openupgrade.migrate()
+def migrate(env, version):
+ openupgrade.load_data(env.cr, "sale", "14.0.1.1/noupdate_changes.xml")
+ openupgrade.delete_record_translations(
+ env.cr,
+ "sale",
+ [
+ "email_template_edi_sale",
+ "mail_template_sale_confirmation",
+ ],
+ )
diff --git a/openupgrade_scripts/scripts/sale/14.0.1.1/pre-migration.py b/openupgrade_scripts/scripts/sale/14.0.1.1/pre-migration.py
new file mode 100644
index 000000000000..936028756bd0
--- /dev/null
+++ b/openupgrade_scripts/scripts/sale/14.0.1.1/pre-migration.py
@@ -0,0 +1,41 @@
+# Copyright 2021 ForgeFlow S.L.
+# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
+from openupgradelib import openupgrade
+
+_xmlid_renames = [
+ (
+ "sale.access_product_product_attribute_custom_value",
+ "sale.access_product_product_attribute_custom_value_sale_manager",
+ ),
+ ("sale.account_move_see_all", "sale.account_invoice_rule_see_all"),
+ ("sale.account_move_personal_rule", "sale.account_invoice_rule_see_personal"),
+ ("sale.account_move_line_see_all", "sale.account_invoice_line_rule_see_all"),
+ (
+ "sale.account_move_line_personal_rule",
+ "sale.account_invoice_line_rule_see_personal",
+ ),
+]
+
+
+def fast_fill_sale_order_currency_id(env):
+ if not openupgrade.column_exists(env.cr, "sale_order", "currency_id"):
+ openupgrade.logged_query(
+ env.cr,
+ """
+ ALTER TABLE sale_order
+ ADD COLUMN currency_id integer""",
+ )
+ openupgrade.logged_query(
+ env.cr,
+ """
+ UPDATE sale_order so
+ SET currency_id = pp.currency_id
+ FROM product_pricelist pp
+ WHERE so.pricelist_id = pp.id""",
+ )
+
+
+@openupgrade.migrate()
+def migrate(env, version):
+ openupgrade.rename_xmlids(env.cr, _xmlid_renames)
+ fast_fill_sale_order_currency_id(env)
diff --git a/openupgrade_scripts/scripts/sale/14.0.1.1/upgrade_analysis_work.txt b/openupgrade_scripts/scripts/sale/14.0.1.1/upgrade_analysis_work.txt
new file mode 100644
index 000000000000..1a550ce845fd
--- /dev/null
+++ b/openupgrade_scripts/scripts/sale/14.0.1.1/upgrade_analysis_work.txt
@@ -0,0 +1,75 @@
+---Models in module 'sale'---
+model product.attribute.custom.value (moved to product)
+new model sale.order.cancel [transient]
+---Fields in module 'sale'---
+sale / crm.team / invoiced (integer) : type is now 'float' ('integer')
+sale / crm.team / invoiced_target (integer) : type is now 'float' ('integer')
+sale / crm.team / quotations_amount (integer) : type is now 'float' ('integer')
+# NOTHING TO DO: Automatic conversion from integer to float is assured by PG
+
+sale / product.attribute / display_type (selection) : module is now 'product' ('sale')
+sale / product.attribute.custom.value / __last_update (datetime) : module is now 'product' ('sale')
+sale / product.attribute.custom.value / _order : module is now 'product' ('sale')
+sale / product.attribute.custom.value / custom_product_template_attribute_value_id (many2one): module is now 'product' ('sale')
+sale / product.attribute.custom.value / custom_value (char) : module is now 'product' ('sale')
+sale / product.attribute.custom.value / display_name (char) : module is now 'product' ('sale')
+sale / product.attribute.custom.value / name (char) : module is now 'product' ('sale')
+sale / product.attribute.value / display_type (selection) : module is now 'product' ('sale')
+sale / product.attribute.value / html_color (char) : module is now 'product' ('sale')
+sale / product.attribute.value / is_custom (boolean) : module is now 'product' ('sale')
+sale / product.template.attribute.value / display_type (selection) : module is now 'product' ('sale')
+sale / product.template.attribute.value / html_color (char) : module is now 'product' ('sale')
+sale / product.template.attribute.value / is_custom (boolean) : module is now 'product' ('sale')
+sale / sale.order / tag_ids (many2many) : previously in module sale_crm
+# NOTHING TO DO: handled by ORM
+
+sale / sale.order / currency_id (many2one) : is now stored
+# DONE: pre-migration: fast filled
+
+sale / sale.order / show_update_pricelist (boolean): NEW
+# NOTHING TO DO: new technical field
+
+---XML records in module 'sale'---
+DEL ir.actions.act_window: sale.action_open_sale_onboarding_sample_quotation
+NEW ir.model.access: sale.access_account_invoice_send_salesman
+NEW ir.model.access: sale.access_payment_link_wizard_sale
+NEW ir.model.access: sale.access_sale_advance_payment_inv
+NEW ir.model.access: sale.access_sale_order_cancel
+NEW ir.model.access: sale.access_sale_order_line_readonly
+NEW ir.model.access: sale.access_sale_order_readonly
+NEW ir.model.access: sale.access_sale_payment_acquirer_onboarding_wizard
+DEL ir.model.access: sale.access_account_journal_sale_manager
+DEL ir.model.access: sale.access_ir_property_sales
+# NOTHING TO DO
+
+DEL ir.model.access: sale.access_product_product_attribute_custom_value
+NEW ir.model.access: sale.access_product_product_attribute_custom_value_sale_manager
+# DONE: pre-migration: renamed xmlid
+
+NEW ir.rule: sale.account_invoice_send_rule_see_all (noupdate)
+NEW ir.rule: sale.account_invoice_send_rule_see_personal (noupdate)
+NEW ir.rule: sale.sale_advance_payment_inv_rule (noupdate)
+NEW ir.rule: sale.sale_order_cancel_rule (noupdate)
+NEW ir.rule: sale.sale_payment_acquirer_onboarding_wizard_rule (noupdate)
+# NOTHING TO DO
+
+NEW ir.rule: sale.account_invoice_line_rule_see_personal (noupdate)
+NEW ir.rule: sale.account_invoice_line_rule_see_all (noupdate)
+NEW ir.rule: sale.account_invoice_rule_see_personal (noupdate)
+NEW ir.rule: sale.account_invoice_rule_see_all (noupdate)
+DEL ir.rule: sale.account_move_line_personal_rule (noupdate)
+DEL ir.rule: sale.account_move_line_see_all (noupdate)
+DEL ir.rule: sale.account_move_personal_rule (noupdate)
+DEL ir.rule: sale.account_move_see_all (noupdate)
+# DONE: pre-migration: renamed xmlids
+
+NEW ir.ui.menu: sale.menu_tag_config
+NEW ir.ui.view: sale.sale_order_cancel_view_form
+NEW ir.ui.view: sale.sale_order_line_view_kanban
+DEL ir.ui.view: sale.attribute_tree_view
+DEL ir.ui.view: sale.product_attribute_view_form
+DEL ir.ui.view: sale.product_template_attribute_line_form
+DEL ir.ui.view: sale.product_template_attribute_value_view_form_inherit
+DEL ir.ui.view: sale.product_template_attribute_value_view_tree_inherit
+DEL ir.ui.view: sale.sale_onboarding_sample_quotation_form
+# NOTHING TO DO