Skip to content

[17.0][IMP] sale_invoice_plan: pending planned invoices#3823

Open
ChristianSantamaria wants to merge 1 commit intoOCA:17.0from
solvosci:17.0-imp-sale_invoice_plan_pending
Open

[17.0][IMP] sale_invoice_plan: pending planned invoices#3823
ChristianSantamaria wants to merge 1 commit intoOCA:17.0from
solvosci:17.0-imp-sale_invoice_plan_pending

Conversation

@ChristianSantamaria
Copy link
Copy Markdown

Shows pending planned invoices for the Sale Order according to its Invoice Plan.

@OCA-git-bot
Copy link
Copy Markdown
Contributor

Hi @kittiu,
some modules you are maintaining are being modified, check this out!

@ChristianSantamaria ChristianSantamaria force-pushed the 17.0-imp-sale_invoice_plan_pending branch 2 times, most recently from ebb1481 to 317091a Compare July 18, 2025 09:54
@DantePereyra DantePereyra force-pushed the 17.0-imp-sale_invoice_plan_pending branch from 317091a to c57d832 Compare July 22, 2025 12:26
@ChristianSantamaria ChristianSantamaria force-pushed the 17.0-imp-sale_invoice_plan_pending branch from c57d832 to 445aaff Compare August 4, 2025 08:06
Shows pending planned invoices for the Sale Order according to its Invoice Plan.
@ChristianSantamaria ChristianSantamaria force-pushed the 17.0-imp-sale_invoice_plan_pending branch from 445aaff to a2021eb Compare August 4, 2025 08:11
@ChristianSantamaria ChristianSantamaria marked this pull request as ready for review August 4, 2025 08:12
@ChristianSantamaria
Copy link
Copy Markdown
Author

@marcelsavegnago @kittiu Can u review this improvement?

Copy link
Copy Markdown
Contributor

@dalonsod dalonsod left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only code review 👍

@dalonsod
Copy link
Copy Markdown
Contributor

@Saran440 could you review? Thanks!

Copy link
Copy Markdown

@alexey-pelykh alexey-pelykh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review: sale_invoice_plan - pending planned invoices

The core feature (stored computed invoice_plan_pending field, tree column, search filter, migration, tests) is well implemented. A few items to address:

Issues Found

# Severity Finding
1 🟡 Medium README.rst maturity badge regression: The alt text changed from Production/Stable to Alpha, and license became licence. The manifest still says "development_status": "Production/Stable". This looks like an unintended artifact of oca-gen-addon-readme regeneration with possibly stale/wrong config. The same issue propagates to index.html.
2 🟢 Minor Migration: NULL vs 0 gap: The pre-migration SQL only updates orders that have pending plans. Orders with all plans invoiced (or no plans) remain NULL. The ORM compute returns 0 for those. Consider adding a final UPDATE sale_order SET invoice_plan_pending = 0 WHERE invoice_plan_pending IS NULL to ensure consistency between migrated data and freshly computed data.

What Looks Good

  • store=True with @api.depends("invoice_plan_ids.invoiced") is the right approach for a field displayed in tree/search views
  • openupgradelib usage in the migration is correct: column_exists guard, openupgrade.add_columns, openupgrade.logged_query
  • Test coverage is solid: checks pending count after plan creation, after partial invoicing, and after full invoicing across multiple test methods
  • Search filter and tree view integration are clean

Overall the implementation is sound. Addressing the README badge regression and the minor migration gap would make this ready to merge.

:target: https://odoo-community.org/page/development-status
:alt: Production/Stable
.. |badge2| image:: https://img.shields.io/badge/license-AGPL--3-blue.png
:alt: Alpha
Copy link
Copy Markdown

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/Stable to Alpha, and license became licence (line 16). The __manifest__.py still declares "development_status": "Production/Stable". This looks like an unintended side effect of regenerating the README with possibly stale or misconfigured oca-gen-addon-readme. Could you verify and regenerate with the correct settings?

WHERE so.id = sub.sale_id;
""",
)
_logger.info("Updated invoice_plan_pending for existing sale orders.")
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor: this UPDATE only sets invoice_plan_pending for orders that have at least one non-invoiced plan. Orders with zero pending plans (all invoiced or no plans at all) will keep invoice_plan_pending = NULL. The ORM compute method would return 0 for those.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants