Skip ke Konten
Menu
Pertanyaan ini telah diberikan tanda
2 Replies
9206 Tampilan

What do i need to do besides defining a customized view for a user (under user interface) to get that user to see it instead of the original one?

I need to remove many fields and add 2 new ones on that view.

Or should i do it inheriting a view? That way, i know how to add fields, but not remove them.

 

Thank you.

Avatar
Buang
Jawaban Terbai

I hope that the best way is to inherit the view.

To replace the field, use the following code example...

<record model="ir.ui.view" id="view_partner_form2">
<field name="name">res.partner.form.inherit2</field>
<field name="model">res.partner</field>
<field name="inherit_id" ref="base.view_partner_form"/>
<field name="arch" type="xml">

<field name="Field1_name_to_replace" position="replace"/>

<field name="Field2_name_to_replace" position="replace"/>

<Code to add the fields>

</field>
</record>

In the above Code,

<field name="X" position="replace"/> remove the X from view.

For more details please refer the https://doc.odoo.com/6.0/developer/2_6_views_events/views/view_inheritence/

 

Avatar
Buang
Penulis

Looking at that example, i am kinda lost as to what to use in some fields (same thing in the documentation). I am currently working with the views "fleet.vehicle.form" and "fleet.vehicle.tree" (model fleet.vehicle). I need to remove many things from the form view (and add 2 text fields), and i have to replace some fields from the tree view (and re-order it). I am working directly in settings > user interface > views, now inheriting instead of modifying the original views. If i only use: I can add the fields (i actually wanted to add one field before one of the stock ones, and the other field after, but it seems i don't know how to do that with just one view, the following code gives an error: In a similar fachion, i can remove stuff with: But if i want to remove more than one thing in a view: I get an error, similar to what happened when i tried 2 fields in diferent places before. The documentation speaks about werapping it in "data", but that does not seem to work. Also, all that "record" stuff makes me thing that the documentation is not actually for this case (creating views in the ui). Any further help would be appreciated. ps: i tried replacing the complete view with my version, but i failed at that too.

Penulis

NO idea what happened to my examples: This was for removing 2 things in one view:

Penulis

Ok, now i see that xml is stripped from comments T_T group string="Additional Properties" position="replace" group string="Engine Options" position="replace" Imagine the are actally there

Penulis Jawaban Terbai

Well, neither the link nor the particular extract given was a direct solution for me, but it helped me learn how to add/remove single items (one field per view when removing). Then i learned how to replace the whole thing with what i wanted, which was the final solution xD

Thanks.

Avatar
Buang