Skip to content

[16.0][IMP] rental_base_extension: post_init_hook for existing records#885

Merged
eantones merged 1 commit into16.0from
16.0-imp-rental_base_extension-post_init_hook
Apr 2, 2026
Merged

[16.0][IMP] rental_base_extension: post_init_hook for existing records#885
eantones merged 1 commit into16.0from
16.0-imp-rental_base_extension-post_init_hook

Conversation

@eantones
Copy link
Copy Markdown
Member

@eantones eantones commented Apr 2, 2026

Summary

  • When rental modules are installed on a database with existing sale orders, type_id, rental and can_sell_rental fields remain NULL because defaults/computes only apply to new records
  • This causes errors when editing old quotations (Order Type radio buttons blank, attrs evaluation fails)
  • Adds a post_init_hook that sets the correct defaults on existing records via SQL (xmlid resolved via ORM)

Test plan

  • Install rental_base_extension on a database with existing sale orders
  • Verify all orders have type_id set to "Normal Order"
  • Verify all order lines have rental = False and can_sell_rental = False
  • Open an old quotation and confirm no errors, Order Type shows "Pedido Normal"

When the rental modules are installed on a database with existing sale
orders, several fields remain NULL because defaults and computes only
apply to new records. This causes errors when editing old quotations
(the Order Type radio buttons appear blank, attrs evaluation fails).

The post_init_hook sets the correct default values on existing records:
- sale_order.type_id = normal_sale_type (xmlid via ORM, update via SQL)
- sale_order_line.rental = False
- sale_order_line.can_sell_rental = False
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 2, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 44.41%. Comparing base (ec6499b) to head (ef90143).
⚠️ Report is 2 commits behind head on 16.0.

Additional details and impacted files
@@            Coverage Diff             @@
##             16.0     #885      +/-   ##
==========================================
+ Coverage   44.30%   44.41%   +0.11%     
==========================================
  Files         313      314       +1     
  Lines        6230     6243      +13     
  Branches      989      989              
==========================================
+ Hits         2760     2773      +13     
  Misses       3449     3449              
  Partials       21       21              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@eantones eantones merged commit 4656c25 into 16.0 Apr 2, 2026
13 checks passed
@eantones eantones deleted the 16.0-imp-rental_base_extension-post_init_hook branch April 2, 2026 14:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant