Skip to Content
Menu

Hide Add a Line when Not Draft

by
Odoo

16.38

v 17.0 Third Party
Availability
Odoo Online
Odoo.sh
On Premise
Odoo Apps Dependencies Invoicing (account)
Discuss (mail)
Lines of code 24
Technical Name rlk_disable_add_line
LicenseLGPL-3
Websitehttps://ryanlinnok.github.io
You bought this module and need support? Click here!
Availability
Odoo Online
Odoo.sh
On Premise
Odoo Apps Dependencies Invoicing (account)
Discuss (mail)
Lines of code 24
Technical Name rlk_disable_add_line
LicenseLGPL-3
Websitehttps://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

  • The author can leave a single reply to each comment.
  • This section is meant to ask simple questions or leave a rating. Every report of a problem experienced while using the module should be addressed to the author directly (refer to the following point).
  • If you want to start a discussion with the author or have a question related to your purchase, please use the support page.