Skip to Content
Menu
This question has been flagged
2 Replies
1715 Views

I need to add 3 optional columns to an existing form view, with the menu on the right side with the three dots.(The one to add columns or remove them)

Right there I need to add 3 columns to choose:

  • Internal reference
  • Manufacturer reference I
  • Manufacturer

This is my current view:

xml version="1.0" encoding="UTF-8" ?>
<odoo>
<record model="ir.ui.view" id="view_inventory_form_inh">
<field name="name">view.inventory.form.inhfield>
<field name="model">stock.inventoryfield>
<field name="inherit_id" ref="stock.view_inventory_form" />
<field name="arch" type="xml">
<field name="location_ids" position="before">
<field
name="manufacturer_ids"
widget="many2many_tags"
domain="[('is_manufacturer', '=', True)]"
attrs="{'invisible':[('filter','!=','manufacturers')],
'readonly': [('state', '!=', 'draft')]}"
/>
field>
field>
record>
odoo>

I already added the fields in the model. 

Does anybody know how I add these columns in the view ? 

Avatar
Discard
Best Answer

Hi John,

We can create a dynamic tree view (add optional columns in three dots) by providing an attribute called "optional'.

for example:

To show the optional column by default:

<field name="FIELD_NAME" optional="show"/>

To hide the optional column by default:

<field name="FIELD_NAME" optional="hide"/>


Now we can change the field's visibility by checking and unchecking the checkbox in the three dots.

Regards

Avatar
Discard
Author Best Answer

Do I also need an xpath-expression? Because i want to show fields of the parent view and also fields that are defined in the same module in the model class, how can I use them in the view ?

What kind of xpath-expression do I need in this case? Or is there any other way?

 

Avatar
Discard
Related Posts Replies Views Activity
1
Oct 20
2036
0
Mar 16
3558
1
Apr 15
11663
1
Aug 24
314
2
May 24
898