MouTio
MouTio

Reputation: 1289

How can I hide (or disable) the add item option in form view? In Odoo 9

I have a custom form for sale.order view.

I want to allow to edit the lines but I dont want to allow to add new lines.

Basically I want to delete or hide the option of "add new item" located at the bottom of the lines.

There is that in the code:

...
<notebook>
  <page string="Lineas de pedido">
      <field name="order_line" mode="tree,kanban"
             attrs="{'readonly': [('state', 'in', ('done','cancel'))]}">
...

But modifying this, affects to whole edition.

Only for more information, I saw that the class applied to the row is:

oe_form_field_x2many_list_row_add

But this is standard for all forms, and I cannot modify it.

Upvotes: 2

Views: 3566

Answers (1)

Charif DZ
Charif DZ

Reputation: 14741

if you want to remove the additem just disable create in embaded tree of x2many field:

<field name="order_line" mode="tree,kanban"
             attrs="{'readonly': [('state', 'in', ('done','cancel'))]}">
            <tree create="0" ....>
              ....
              .....               

Upvotes: 4

Related Questions