Availability |
Odoo Online
Odoo.sh
On Premise
|
Odoo Apps Dependencies |
•
Invoicing (account)
• Discuss (mail) |
Lines of code | 24 |
Technical Name |
rlk_disable_add_line |
License | LGPL-3 |
Website | https://ryanlinnok.github.io |
Availability |
Odoo Online
Odoo.sh
On Premise
|
Odoo Apps Dependencies |
•
Invoicing (account)
• Discuss (mail) |
Lines of code | 24 |
Technical Name |
rlk_disable_add_line |
License | LGPL-3 |
Website | https://ryanlinnok.github.io |
Introduction
This module, X2ManyList Control, is designed to automatically hide the "Add a line" button and the trash icon in x2Many fields when the record is not in draft status, while keeping other columns editable as long as the field is not readonly.
Key Features
The module modifies the behavior of all x2Many fields by:
- Hiding the "Add a line" button when the record is not in draft status.
- Disabling the trash icon to prevent deleting rows in the same condition.
- Ensuring existing rows remain editable unless the field itself is readonly.
- Works generically for any model that has a
state
field.

Configuration
No configuration is required. Once installed, the system will automatically
apply the behavior to all views containing x2Many fields that belong to
records with a state
field.

Customization
Developers can further adapt the module by modifying the included JavaScript patch:
- hide_add_line.js - Extends the ListRenderer to dynamically hide or show the "Add a line" and trash icon based on the parent record state.
Please log in to comment on this module