-
-
Notifications
You must be signed in to change notification settings - Fork 784
[16.0][OU-ADD] sale_stock #4015
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
openupgrade_scripts/scripts/sale_stock/16.0.1.0/pre-migration.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| # Copyright 2023 Coop IT Easy SC | ||
| # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). | ||
|
|
||
| from openupgradelib import openupgrade | ||
|
|
||
|
|
||
| def compute_sale_order_delivery_status(env): | ||
| openupgrade.add_fields( | ||
| env, | ||
| [ | ||
| ( | ||
| "delivery_status", | ||
| "sale.order", | ||
| False, | ||
| "selection", | ||
| False, | ||
| "sale_stock", | ||
| ) | ||
| ], | ||
| ) | ||
| openupgrade.logged_query( | ||
| env.cr, | ||
| """ | ||
| with so_delivery_status as ( | ||
| select | ||
| sale_id as id, | ||
| case | ||
| when | ||
| count(state) filter ( | ||
| where state = 'cancel' | ||
| ) = count(state) | ||
| then null | ||
| when | ||
| count(state) filter ( | ||
| where state not in ('done', 'cancel') | ||
| ) = 0 | ||
| then 'full' | ||
| when | ||
| count(state) filter (where state = 'done') > 0 | ||
| then 'partial' | ||
| else 'pending' | ||
| end as delivery_status | ||
| from stock_picking | ||
| group by 1 | ||
| order by 1 | ||
| ) | ||
| update sale_order as so | ||
| set delivery_status = so_delivery_status.delivery_status | ||
| from so_delivery_status | ||
| where so_delivery_status.id = so.id; | ||
| """, | ||
| ) | ||
|
|
||
|
|
||
| @openupgrade.migrate() | ||
| def migrate(env, version): | ||
| compute_sale_order_delivery_status(env) | ||
16 changes: 16 additions & 0 deletions
16
openupgrade_scripts/scripts/sale_stock/16.0.1.0/upgrade_analysis_work.txt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| ---Models in module 'sale_stock'--- | ||
| ---Fields in module 'sale_stock'--- | ||
| sale_stock / sale.order / delivery_status (selection) : NEW selection_keys: ['full', 'partial', 'pending'], isfunction: function, stored | ||
pedrobaeza marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| # DONE: pre-migration: fast computed delivery_status | ||
| sale_stock / sale.order / incoterm_location (char) : NEW | ||
| sale_stock / sale.order.line / product_type (selection) : module is now 'sale' ('sale_stock') | ||
| sale_stock / sale.order.line / route_id (many2one) : relation is now 'stock.route' ('stock.location.route') [nothing to do] | ||
| sale_stock / stock.location.route / sale_selectable (boolean) : DEL | ||
| sale_stock / stock.route / sale_selectable (boolean) : NEW | ||
| # NOTHING TO DO | ||
| ---XML records in module 'sale_stock'--- | ||
| DEL ir.ui.menu: sale_stock.menu_aftersale | ||
| DEL ir.ui.menu: sale_stock.menu_invoiced | ||
| DEL ir.ui.view: sale_stock.product_template_view_form_inherit_sale | ||
| DEL ir.ui.view: sale_stock.product_template_view_form_inherit_stock | ||
| # NOTHING TO DO | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.