Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

How do "customized views" work?

By
Roberto Cocchiararo
on 11/3/14, 8:21 AM 1,447 views

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.

1
Rajiv
On 11/3/14, 8:51 AM

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/

 

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.

Roberto Cocchiararo
on 11/4/14, 11:03 AM

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

Roberto Cocchiararo
on 11/4/14, 11:04 AM

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

Roberto Cocchiararo
on 11/4/14, 11:05 AM
0
Roberto Cocchiararo
On 11/7/14, 10:34 AM

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.

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 11/3/14, 8:21 AM
Seen: 1447 times
Last updated: 3/16/15, 8:10 AM