forked from OCA/OpenUpgrade
-
Notifications
You must be signed in to change notification settings - Fork 3
fixup! [OU-ADD] account #25
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
MiquelRForgeFlow
merged 2 commits into
ForgeFlow:18.0-mig-account
from
hbrunn:18.0-account
May 5, 2025
Merged
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
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 |
|---|---|---|
|
|
@@ -4,7 +4,6 @@ | |
| from openupgradelib import openupgrade | ||
|
|
||
| field_renames = [ | ||
| ("account.account", "account_account", "code", "code_store"), | ||
| ("account.move", "account_move", "payment_id", "origin_payment_id"), | ||
| ("account.move", "account_move", "reversal_move_id", "reversal_move_ids"), | ||
| ("account.move", "account_move", "send_and_print_values", "sending_data"), | ||
|
|
@@ -135,23 +134,6 @@ def adapt_account_move_sending_data(env): | |
| '{author_user_id}', sending_data::jsonb->'sp_user_id') | ||
| WHERE sending_data IS NOT NULL AND sending_data::jsonb ? 'sp_user_id'""", | ||
| ) | ||
| # mail_template_id -> mail_template: | ||
| env.cr.execute( | ||
| """ | ||
| SELECT id, sending_data::jsonb->'mail_template_id' as mail_template_id | ||
| FROM account_move | ||
| WHERE sending_data IS NOT NULL AND sending_data::jsonb ? 'mail_template_id'""", | ||
| ) | ||
| for move_id, mail_template_id in env.cr.fetchall(): | ||
| mail_template = env.ref(mail_template_id) | ||
| openupgrade.logged_query( | ||
| env.cr, | ||
| f""" | ||
| UPDATE account_move | ||
| SET sending_data = jsonb_set(sending_data::jsonb - 'mail_template_id', | ||
| '{{mail_template}}', {mail_template}) | ||
| WHERE id = {move_id}""", | ||
| ) | ||
|
Author
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. the sending_data field is only used for the batch wizard, and there the mail template can't be set at all. See the test data file that actually fills this field for the test migration, the above code fails there because this is an id in v17 |
||
| # send_mail: True -> 'sending_methods': {"email"}: | ||
| openupgrade.logged_query( | ||
| env.cr, | ||
|
|
||
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
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,13 @@ | ||
| env = locals().get("env") | ||
| # call sending wizard on some moves asynchronously | ||
| action = ( | ||
| env["account.move"] | ||
| .search([("move_type", "=", "out_invoice")]) | ||
| .action_send_and_print() | ||
| ) | ||
| env[action["res_model"]].with_context(**action["context"]).create( | ||
| { | ||
| "checkbox_download": False, | ||
| } | ||
| ).action_send_and_print() | ||
| env.cr.commit() |
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.
it wasn't a property before, we need to create our own property field