OdooTech notes

Change editable attribute on inherited Tree view

odoo personalizzazioni

Found this useful method to change editable attribute on inherited Tree view.

As in the case of stock.move you cannot simply inherit and set your view attribute in tree tag as, for example, editable=’top’.

The solution is to change attribute in the view like this:

<record id="stock_move_treeview_custom1" model="ir.ui.view">
   <field name="name">stock.move.inherited1</field>
   <field name="model">stock.move</field>
   <field name="inherit_id" ref="stock.view_move_tree"/>
   <field name="arch" type="xml">
   <xpath expr="//tree" position="attributes">
      <attribute name="editable">top</attribute>
   <xpath expr="//field[@name='location_dest_id']" position="before">
      <field name="product_uom_qty"/>
      <field name="quantity_done"/>
      <field name="barcode"/>

Hope this can be useful for someone and feel free to leave a comment.

Comment here