Skip to content
Draft
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/modules190-200.rst
Original file line number Diff line number Diff line change
Expand Up @@ -862,7 +862,7 @@ Module coverage 19.0 -> 20.0
+---------------------------------------------------+----------------------+-------------------------------------------------+
| |del| pos_restaurant_stripe | | |
+---------------------------------------------------+----------------------+-------------------------------------------------+
| pos_sale | | |
| pos_sale |Done | |
+---------------------------------------------------+----------------------+-------------------------------------------------+
| |new| pos_sale_delivery | |No DB layout changes. |
+---------------------------------------------------+----------------------+-------------------------------------------------+
Expand Down
32 changes: 32 additions & 0 deletions openupgrade_scripts/scripts/pos_sale/20.0.1.1/post-migration.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Copyright 2026 Don Kendall
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from openupgradelib import openupgrade


@openupgrade.migrate()
def migrate(env, version):
"""Point existing points of sale at the default product 20.0 ships.

pos.config.default_product_id is new in 20.0 and defaults to
`pos_sale.default_sol_product`, a product the module itself loads. A default
only runs for rows created after it exists, so every point of sale that
predates the upgrade comes out with none and cannot price a productless
sale order line -- while one created a minute later can.

This is the case the OCA retrospective records us getting wrong last cycle:
a default is not automatically safe, and the question is what it means on a
row that already existed. Here it means the same as on a new one, so the
rows are brought into line with what a fresh install would have.

Only the empty ones: a point of sale that already names a product chose it.
"""
product = env.ref("pos_sale.default_sol_product", raise_if_not_found=False)
if not product:
return
openupgrade.logged_query(
env.cr,
"UPDATE pos_config SET default_product_id = %s "
"WHERE default_product_id IS NULL",
(product.id,),
)
15 changes: 15 additions & 0 deletions openupgrade_scripts/scripts/pos_sale/20.0.1.1/upgrade_analysis.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---Models in module 'pos_sale'---
---Fields in module 'pos_sale'---
pos_sale / pos.config / default_product_id (many2one) : NEW relation: product.product, hasdefault: default
pos_sale / sale.order / amount_unpaid (float) : module is now 'sale' ('pos_sale')
---XML records in module 'pos_sale'---
crm.team: sales_team.pos_sales_team (noupdate switched)
NEW ir.access: pos_sale.pos_sale_rule_pos_channel_pos_manager
NEW ir.access: pos_sale.rule_pos_sale_order
NEW ir.access: pos_sale.rule_pos_sale_order_line
DEL ir.model.access: pos_sale.access_crm_team_pos_manager
DEL ir.rule: pos_sale.pos_sale_rule_pos_channel_pos_manager (noupdate)
NEW ir.ui.view: pos_sale.pos_orderline_receipt_information
DEL ir.ui.view: pos_sale.message_body
product.product: pos_sale.default_downpayment_product (noupdate switched)
NEW product.product: pos_sale.default_sol_product
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---Models in module 'pos_sale'---
---Fields in module 'pos_sale'---
pos_sale / pos.config / default_product_id (many2one) : NEW relation: product.product, hasdefault: default
# NOTHING TO DO: a new field whose default is falsy -- False, or an empty
# list -- so a NULL left on an existing row already means what the default
# would have written. The one flagged field whose default names a record,
# pos.config.default_product_id, has a script instead
pos_sale / sale.order / amount_unpaid (float) : module is now 'sale' ('pos_sale')
# NOTHING TO DO: the field only changed owning module, the column is the same
---XML records in module 'pos_sale'---
crm.team: sales_team.pos_sales_team (noupdate switched)
# NOTHING TO DO: only the noupdate flag changed, the definition is the same
NEW ir.access: pos_sale.pos_sale_rule_pos_channel_pos_manager
NEW ir.access: pos_sale.rule_pos_sale_order
NEW ir.access: pos_sale.rule_pos_sale_order_line
DEL ir.model.access: pos_sale.access_crm_team_pos_manager
DEL ir.rule: pos_sale.pos_sale_rule_pos_channel_pos_manager (noupdate)
# NOTHING TO DO: base folds ir.model.access and ir.rule into ir.access, keeping the xml_ids
NEW ir.ui.view: pos_sale.pos_orderline_receipt_information
# NOTHING TO DO: the record is not noupdate, so the module update creates it
DEL ir.ui.view: pos_sale.message_body
# NOTHING TO DO: the record is not noupdate, so the module update removes it
product.product: pos_sale.default_downpayment_product (noupdate switched)
# NOTHING TO DO: only the noupdate flag changed, the definition is the same
NEW product.product: pos_sale.default_sol_product
# NOTHING TO DO: the record is not noupdate, so the module update creates it
Loading