-
-
Notifications
You must be signed in to change notification settings - Fork 800
[19.0][MIG] purchase #5559
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
Open
hbrunn
wants to merge
2
commits into
OCA:19.0
Choose a base branch
from
hbrunn:19.0-purchase
base: 19.0
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
[19.0][MIG] purchase #5559
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
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
49 changes: 49 additions & 0 deletions
49
openupgrade_scripts/scripts/purchase/19.0.1.2/post-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,49 @@ | ||
| # Copyright 2026 Hunki Enterprises BV | ||
| # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
|
|
||
| from openupgradelib import openupgrade | ||
|
|
||
|
|
||
| def purchase_order_fields(env): | ||
| """ | ||
| Set state = purchase for orders with state == 'done' | ||
| Set locked = true for orders in state purchase if their company is configured | ||
| accordingly | ||
| Set acknowledged=True for orders in state purchase to avoid unexpected reminder | ||
| mails | ||
| """ | ||
| env.cr.execute("UPDATE purchase_order SET state='purchase' WHERE state='done'") | ||
| env.cr.execute("UPDATE purchase_order SET acknowledged=True WHERE state='purchase'") | ||
| env.cr.execute( | ||
| """ | ||
| UPDATE purchase_order SET locked=TRUE | ||
| FROM res_company | ||
| WHERE | ||
| purchase_order.company_id=res_company.id | ||
| AND res_company.po_lock='lock' | ||
| """ | ||
| ) | ||
|
|
||
|
|
||
| def purchase_order_line_technical_price_unit(env): | ||
| """ | ||
| Initialized technical_price_unit with price_unit | ||
| """ | ||
| env.cr.execute("UPDATE purchase_order_line SET technical_price_unit=price_unit") | ||
|
|
||
|
|
||
| @openupgrade.migrate() | ||
| def migrate(env, version): | ||
| openupgrade.load_data(env, "purchase", "19.0.1.2/noupdate_changes.xml") | ||
| openupgrade.delete_record_translations( | ||
| env.cr, | ||
| "purchase", | ||
| [ | ||
| "email_template_edi_purchase", | ||
| "email_template_edi_purchase_done", | ||
| "email_template_edi_purchase_reminder", | ||
| ], | ||
| ["body_html"], | ||
| ) | ||
| purchase_order_fields(env) | ||
| purchase_order_line_technical_price_unit(env) |
28 changes: 28 additions & 0 deletions
28
openupgrade_scripts/scripts/purchase/19.0.1.2/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,28 @@ | ||
| # Copyright 2026 Hunki Enterprises BV | ||
| # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
|
|
||
| from openupgradelib import openupgrade | ||
|
|
||
| renamed_fields = [ | ||
| ("purchase.order", "purchase_order", "note", "notes"), | ||
| ("purchase.order.line", "purchase_order_line", "product_uom", "product_uom_id"), | ||
| ("purchase.order.line", "purchase_order_line", "taxes_id", "tax_ids"), | ||
| ] | ||
|
|
||
| added_fields = [ | ||
| ("locked", "purchase.order", "purchase_order", "boolean", None, "purchase", False), | ||
| ( | ||
| "technical_price_unit", | ||
| "purchase.order.line", | ||
| "purchase_order_line", | ||
| "float", | ||
| None, | ||
| "purchase", | ||
| ), | ||
| ] | ||
|
|
||
|
|
||
| @openupgrade.migrate() | ||
| def migrate(env, version): | ||
| openupgrade.rename_fields(env, renamed_fields) | ||
| openupgrade.add_fields(env, added_fields) | ||
99 changes: 99 additions & 0 deletions
99
openupgrade_scripts/scripts/purchase/19.0.1.2/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,99 @@ | ||
| ---Models in module 'purchase'--- | ||
| ---Fields in module 'purchase'--- | ||
| purchase / product.packaging / purchase (boolean) : DEL | ||
| purchase / product.template / purchase_line_warn (selection): DEL required, selection_keys: ['block', 'no-message', 'warning'] | ||
|
|
||
| # NOTHING TO DO | ||
|
|
||
| purchase / purchase.order / acknowledged (boolean) : NEW | ||
|
|
||
| # DONE: set to True for state == purchase | ||
|
|
||
| purchase / purchase.order / is_late (boolean) : NEW stored: False | ||
|
|
||
| # NOTHING TO DO | ||
|
|
||
| purchase / purchase.order / locked (boolean) : NEW hasdefault: default | ||
|
|
||
| # DONE: precreated in pre-migration, set in post-migration | ||
|
|
||
| purchase / purchase.order / mail_reception_confirmed (boolean): DEL | ||
| purchase / purchase.order / mail_reception_declined (boolean): DEL | ||
| purchase / purchase.order / mail_reminder_confirmed (boolean): DEL | ||
|
|
||
| # NOTHING TO DO | ||
|
|
||
| purchase / purchase.order / note (html) : NEW | ||
| purchase / purchase.order / notes (html) : DEL | ||
|
|
||
| # DONE: renamed in pre-migration | ||
|
|
||
| purchase / purchase.order / receipt_reminder_email (boolean): is now stored | ||
| purchase / purchase.order / receipt_reminder_email (boolean): not a function anymore | ||
| purchase / purchase.order / reminder_date_before_receipt (integer): is now stored | ||
| purchase / purchase.order / reminder_date_before_receipt (integer): not a function anymore | ||
|
|
||
| # NOTHING TO DO: will be recomputed by the ORM | ||
|
|
||
| purchase / purchase.order / state (selection) : selection_keys removed: [done] | ||
|
|
||
| # DONE: mapped done to purchase | ||
|
|
||
| purchase / purchase.order.line / currency_id (many2one) : not stored anymore | ||
| purchase / purchase.order.line / display_type (selection) : selection_keys added: [line_subsection] (most likely nothing to do) | ||
| purchase / purchase.order.line / product_packaging_id (many2one): DEL relation: product.packaging | ||
| purchase / purchase.order.line / product_packaging_qty (float) : DEL | ||
|
|
||
| # NOTHING TO DO | ||
|
|
||
| purchase / purchase.order.line / product_uom (many2one) : DEL relation: uom.uom | ||
| purchase / purchase.order.line / product_uom_id (many2one) : NEW relation: uom.uom | ||
|
|
||
| # DONE: renamed in pre-migration | ||
|
|
||
| purchase / purchase.order.line / state (selection) : not stored anymore | ||
|
|
||
| # NOTHING TO DO | ||
|
|
||
| purchase / purchase.order.line / tax_ids (many2many) : NEW relation: account.tax | ||
| purchase / purchase.order.line / taxes_id (many2many) : DEL relation: account.tax | ||
|
|
||
| # DONE: renamed in pre-migration | ||
|
|
||
| purchase / purchase.order.line / technical_price_unit (float) : NEW | ||
|
|
||
| # DONE: precreated and set to price_unit | ||
|
|
||
| purchase / res.company / po_lead (float) : DEL required | ||
| purchase / res.partner / purchase_warn (selection) : DEL selection_keys: ['block', 'no-message', 'warning'] | ||
|
|
||
| # NOTHING TO DO | ||
|
|
||
| ---XML records in module 'purchase'--- | ||
| NEW ir.actions.act_window: purchase.mail_followers_edit_action_from_purchase | ||
| DEL ir.actions.server: purchase.action_purchase_batch_bills | ||
| DEL ir.model.access: purchase.access_product_category_purchase_manager | ||
| DEL ir.model.access: purchase.access_product_packaging_purchase_manager | ||
| DEL ir.model.access: purchase.access_product_product_purchase_manager | ||
| DEL ir.model.access: purchase.access_product_tag_purchase_manager | ||
| DEL ir.model.access: purchase.access_product_template_purchase_manager | ||
| DEL ir.model.access: purchase.access_uom_category_purchase_manager | ||
| DEL ir.model.access: purchase.access_uom_uom_purchase_manager | ||
| 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_id IS NOT NULL AND date_planned IS NOT NULL))' ('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))')) | ||
| ir.model.constraint: purchase.constraint_purchase_order_line_non_accountable_null_fields (changed definition: is now 'CHECK(display_type IS NULL OR (product_id IS NULL AND price_unit = 0 AND product_uom_qty = 0 AND product_uom_id IS NULL AND date_planned is NULL))' ('check(display_type is null or(product_id is null and price_unit = 0 and product_uom_qty = 0 and product_uom is null and date_planned is null))')) | ||
| DEL ir.ui.menu: purchase.menu_purchase_uom_categ_form_action | ||
| DEL ir.ui.menu: purchase.menu_unit_of_measure_in_config_purchase | ||
| DEL ir.ui.view: purchase.product_packaging_form_view_purchase | ||
| DEL ir.ui.view: purchase.product_packaging_tree_view_purchase | ||
| DEL ir.ui.view: purchase.purchase_partner_kanban_view | ||
| DEL ir.ui.view: purchase.res_partner_view_purchase_account_buttons | ||
|
|
||
| # NOTHING TO DO | ||
|
|
||
| DEL mail.message.subtype: purchase.mt_rfq_done (noupdate) | ||
|
|
||
| # NOTHING TO DO: don't delete subtypes because then messages end up without one | ||
|
|
||
| NEW res.groups.privilege: purchase.res_groups_privilege_purchase | ||
|
|
||
| # NOTHING TO DO |
16 changes: 16 additions & 0 deletions
16
openupgrade_scripts/scripts/purchase_stock/19.0.1.2/post-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,16 @@ | ||
| # Copyright 2026 Hunki Enterprises BV | ||
| # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
|
|
||
| from openupgradelib import openupgrade | ||
|
|
||
|
|
||
| @openupgrade.migrate() | ||
| def migrate(env, version): | ||
| openupgrade.load_data(env, "purchase_stock", "19.0.1.2/noupdate_changes.xml") | ||
| openupgrade.m2o_to_x2m( | ||
|
Comment on lines
+9
to
+10
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. could you change the order of calling these methods? |
||
| env.cr, | ||
| env["purchase.order"], | ||
| "purchase_order", | ||
| "reference_ids", | ||
| "group_id", | ||
| ) | ||
35 changes: 35 additions & 0 deletions
35
openupgrade_scripts/scripts/purchase_stock/19.0.1.2/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,35 @@ | ||
| ---Models in module 'purchase_stock'--- | ||
| ---Fields in module 'purchase_stock'--- | ||
| purchase_stock / procurement.group / purchase_line_ids (one2many) : DEL relation: purchase.order.line | ||
| purchase_stock / product.category / property_account_creditor_price_difference_categ (many2one): DEL relation: account.account | ||
| purchase_stock / product.template / property_account_creditor_price_difference (many2one): DEL relation: account.account | ||
| purchase_stock / product.template / route_ids (False) : DEL mode: modify | ||
|
|
||
| # NOTHING TO DO | ||
|
|
||
| purchase_stock / purchase.order / group_id (many2one) : DEL relation: procurement.group | ||
| purchase_stock / purchase.order / reference_ids (many2many) : NEW relation: stock.reference | ||
|
|
||
| # DONE: filled from group_id | ||
|
|
||
| purchase_stock / purchase.order.line / group_id (many2one) : DEL relation: procurement.group | ||
| purchase_stock / res.partner / group_on (selection) : NEW required, selection_keys: ['1', '2', '3', '4', '5', '6', '7', 'default'], hasdefault: default | ||
| purchase_stock / res.partner / group_rfq (selection) : NEW required, selection_keys: ['all', 'day', 'default', 'week'], hasdefault: default | ||
| purchase_stock / res.partner / suggest_based_on (char) : NEW hasdefault: default | ||
| purchase_stock / res.partner / suggest_days (integer) : NEW hasdefault: default | ||
| purchase_stock / res.partner / suggest_percent (integer) : NEW hasdefault: default | ||
| purchase_stock / stock.reference / purchase_ids (many2many) : NEW relation: purchase.order | ||
| purchase_stock / stock.warehouse / buy_to_resupply (boolean) : not stored anymore | ||
| purchase_stock / stock.warehouse / buy_to_resupply (boolean) : now a function | ||
| purchase_stock / stock.warehouse.orderpoint / available_vendor (many2one) : NEW relation: res.partner, stored: False | ||
| purchase_stock / stock.warehouse.orderpoint / product_supplier_id (many2one): DEL relation: res.partner | ||
| purchase_stock / stock.warehouse.orderpoint / purchase_visibility_days (float): DEL | ||
| purchase_stock / stock.warehouse.orderpoint / vendor_id (many2one) : DEL relation: res.partner | ||
| ---XML records in module 'purchase_stock'--- | ||
| NEW ir.ui.view: purchase_stock.product_view_search_catalog | ||
| NEW ir.ui.view: purchase_stock.stock_reference_purchase_view_form | ||
| DEL ir.ui.view: purchase_stock.product_template_form_view | ||
| DEL ir.ui.view: purchase_stock.stock_reorder_report_search_inherited_purchase_stock | ||
| DEL ir.ui.view: purchase_stock.view_category_property_form | ||
|
|
||
| # NOTHING TO DO |
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.