-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
[17.0][IMP] sale_invoice_plan: pending planned invoices #3823
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
base: 17.0
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| # © 2025 Solvos Consultoría Informática (<http://www.solvos.es>) | ||
| # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
|
||
| import logging | ||
|
|
||
| from openupgradelib import openupgrade | ||
|
|
||
| _logger = logging.getLogger(__name__) | ||
|
|
||
|
|
||
| @openupgrade.migrate() | ||
| def migrate(env, version): | ||
| if not openupgrade.column_exists(env.cr, "sale_order", "invoice_plan_pending"): | ||
| openupgrade.add_columns( | ||
| env, [("sale_order", "invoice_plan_pending", "integer")] | ||
| ) | ||
| _logger.info("Create invoice_plan_pending column in sale_order table.") | ||
| openupgrade.logged_query( | ||
| env.cr, | ||
| """ | ||
| UPDATE sale_order so | ||
| SET invoice_plan_pending = sub.count | ||
| FROM ( | ||
| SELECT sale_id, COUNT(*) AS count | ||
| FROM sale_invoice_plan | ||
| WHERE NOT invoiced | ||
| GROUP BY sale_id | ||
| ) AS sub | ||
| WHERE so.id = sub.sale_id; | ||
| """, | ||
| ) | ||
| _logger.info("Updated invoice_plan_pending for existing sale orders.") | ||
|
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. Minor: this UPDATE only sets Consider adding a follow-up statement to zero out NULLs for consistency: openupgrade.logged_query(
env.cr,
"UPDATE sale_order SET invoice_plan_pending = 0 WHERE invoice_plan_pending IS NULL",
)This ensures migrated data matches what the compute method would produce. |
||
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.
The alt text here changed from
Production/StabletoAlpha, andlicensebecamelicence(line 16). The__manifest__.pystill declares"development_status": "Production/Stable". This looks like an unintended side effect of regenerating the README with possibly stale or misconfiguredoca-gen-addon-readme. Could you verify and regenerate with the correct settings?