Skip to Content
Menu
You need to be registered to interact with the community.
This question has been flagged
2 Odgovori
2954 Prikazi

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
Opusti
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
Opusti
Avtor 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
Opusti
Related Posts Odgovori Prikazi Aktivnost
1
okt. 20
2828
0
mar. 16
4479
1
apr. 15
13266
1
avg. 24
2192
2
maj 24
2919