Delete Section Only - Safe Section Deletion for Odoo 19
by Odoo DevHouse https://apps.odoo.com/apps/modules/browse?author=Odoo%20DevHouse$ 30.00
| Availability |
Odoo Online
Odoo.sh
On Premise
|
| Odoo Apps Dependencies |
•
Invoicing (account)
• Discuss (mail) |
| Lines of code | 95 |
| Technical Name |
safe_section_delete |
| License | OPL-1 |
| Website | https://apps.odoo.com/apps/modules/browse?author=Odoo%20DevHouse |
| Availability |
Odoo Online
Odoo.sh
On Premise
|
| Odoo Apps Dependencies |
•
Invoicing (account)
• Discuss (mail) |
| Lines of code | 95 |
| Technical Name |
safe_section_delete |
| License | OPL-1 |
| Website | https://apps.odoo.com/apps/modules/browse?author=Odoo%20DevHouse |
Delete Section Only - Safe Section Deletion for Odoo 19
When deleting a section or subsection in Odoo 19, choose whether to delete just the section header or the section together with all its child lines. Perfect for accountants and financial users who need to reorganize journal entries, invoices, or any editable list view with section headers without losing existing line data.
In Odoo 19, when you delete a Section or Subsection from any editable list view (journal entries, invoices, purchase orders, sales orders, etc.), Odoo automatically deletes all child lines inside that section - with no warning and no choice.
This creates a serious problem:
- A single click can delete dozens or hundreds of lines unintentionally
- No confirmation or alternative - the deletion is immediate and irreversible
- Financial users lose valuable data when just reorganizing section headers
- Time-consuming manual re-entry of deleted lines is required
This module intercepts the section deletion action and presents a confirmation dialog with two distinct options. Users can choose exactly what they want to do:
- Delete Section Only - removes just the section header, preserving all child lines
- Delete Section and Contents - removes the section AND all its child lines (original Odoo behavior)
- Two-Choice Delete Dialog: When deleting a section with children, choose between "Delete Section Only" or "Delete Section and Contents"
- Preserve Child Lines: Delete just the section header while keeping all line items intact
- Full Cascade Deletion: Original Odoo behavior still available when needed
- Works on All Section Types: Supports both Sections and Sub-subsections
- Odoo 19 Optimized: Built specifically for Odoo 19's SectionAndNoteListRenderer component
- No Confirmation for Empty Sections: When a section has no children, deletion is immediate (no unnecessary dialog)
- Works Everywhere: Journal entries, invoices, credit notes, purchase orders, sales orders - any editable list with sections
- Clean Patch Implementation: Uses Odoo's native patching system - no core file modifications
1. Section with Child Lines - Kebab Menu Delete
Click the kebab menu (three dots) on any section that contains child lines, then click Delete.
2. Delete Confirmation Dialog Appears
The module intercepts the deletion and shows a dialog with two clear choices.
3. Delete Section Only - Child Lines Preserved
Choose "Delete Section Only" - the section header is removed, but all child lines remain in the list.
4. Delete Section and Contents - Full Removal
Choose "Delete Section and Contents" - both section header and all child lines are deleted (original Odoo behavior).
Installation & Configuration
- Install the Module: Install through Odoo Apps or manually copy to addons path
- Restart Server & Update: Restart Odoo and update the app list
- No Configuration Required: Module works immediately after installation
- Test: Open any journal entry or invoice with sections containing lines, click delete on a section - the dialog appears
Step 1: Navigate to an Editable List with Sections
Open any editable document that uses sections and line items, such as:
- Journal Entry (Accounting -> Journal Entries -> Create/Edit)
- Customer Invoice (Accounting -> Customers -> Invoices)
- Vendor Bill (Accounting -> Vendors -> Bills)
- Sales Order (Sales -> Orders -> Quotations)
- Purchase Order (Purchase -> Orders -> Requests for Quotation)
Step 2: Locate a Section with Child Lines
Identify a section header (bold row with "Section" display type) that has line items indented below it.
Step 3: Click the Kebab Menu and Select Delete
Click the three dots () at the end of the section row, then click "Delete".
Step 4: Choose Your Option in the Confirmation Dialog
A dialog appears with two choices:
- "Delete Section Only" - Keeps all child lines, removes only the section header
- "Delete Section and its X line(s)" - Removes both section header and all child lines
Step 5: Verify the Result
After choosing:
- If you chose "Delete Section Only" - the section header is gone, but all line items remain in the list
- If you chose "Delete Section and Contents" - both the section header and all its children are removed
Pro Tip - When to Use Each Option
Delete Section Only - Use when reorganizing your document structure. You want to remove the section heading but keep all the accounting entries or product lines underneath. The lines will remain as free-floating items (belonging to no section).
Delete Section and Contents - Use when you need to completely remove a group of lines. For example, removing an entire category of expenses from a journal entry or removing a product category from a quotation.
Important Note
If you delete a section that has no child lines, no confirmation dialog appears - the deletion happens immediately (same as original Odoo behavior). The dialog only appears when there is at least one child line to protect.
Journal Entry Reorganization
Remove or rename section headers without losing the underlying accounting entries beneath them.
Invoice Restructuring
Reorganize invoice line grouping by adding/removing section headers without rebuilding the entire invoice.
Purchase Order Cleanup
Remove temporary section dividers without deleting the product lines that took time to add.
Sales Order Maintenance
Update quotation section headers without recreating product line configurations.
Template Management
Edit section-only templates without losing predefined line items.
Audit Trail Preservation
Preserve financial line history while removing organizational section headers.
Prevent Data Loss
Prevent accidental deletion of valuable line data when removing section headers - save time and frustration.
Flexible Document Management
Reorganize document structure freely - remove sections without rebuilding the entire document from scratch.
User Confidence
Users no longer fear deleting sections - the confirmation dialog gives them control over the outcome.
Time Savings
Eliminate the need to re-add dozens or hundreds of lines after accidentally deleting a section.
Do You Need Assistance or Have a Feature Request?
Odoo Proprietary License v1.0 This software and associated files (the "Software") may only be used (executed, modified, executed after modifications) if you have purchased a valid license from the authors, typically via Odoo Apps, or if you have received a written agreement from the authors of the Software (see the COPYRIGHT file). You may develop Odoo modules that use the Software as a library (typically by depending on it, importing it and using its resources), but without copying any source code or material from the Software. You may distribute those modules under the license of your choice, provided that this license is compatible with the terms of the Odoo Proprietary License (For example: LGPL, MIT, or proprietary licenses similar to this one). It is forbidden to publish, distribute, sublicense, or sell copies of the Software or modified copies of the Software. The above copyright notice and this permission notice must be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Please log in to comment on this module