Skip to Content
Meniu
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
Această întrebare a fost marcată
2 Răspunsuri
2918 Vizualizări

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 ? 

Imagine profil
Abandonează
Cel mai bun răspuns

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

Imagine profil
Abandonează
Autor Cel mai bun răspuns

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?

 

Imagine profil
Abandonează
Related Posts Răspunsuri Vizualizări Activitate
1
oct. 20
2804
0
mar. 16
4463
1
apr. 15
13212
1
aug. 24
2150
2
mai 24
2878