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.

1

Why can't I override the "name" field on the Sales Order Lines view?

By
Jeff Beidler
on 2/11/15, 4:47 PM 694 views

I have created a little module to tweak the display of sales order lines shown in the quote/order form view.  The original view has both "Product" and "Description" at the beginning of each line.  The "Description" column is actually displaying the "name" field.  Since these two fields end up displaying the same data, I want to hide or remove the name field.  In my view code, I have tried:

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

and

<field name="name" position="replace">
    <field name="name" invisible="1"/>
</field>

Neither works, even though I have set the view priority all the way down to 1.  I have also tried simply changing the label on the name field, like this:

<field name="name" position="attributes">
    <attribute name="string" >Part Num.</attribute>
</field>

This also has no effect on the display.  If my view has the lowest priority (sequence) number, then why do my changes have no effect?

Which view are you inheriting? The Sale Order form view is where you would need to make that change as the tree view is defined inline there instead of it's own view.

Bista Solutions US, Ray Carnes
on 2/11/15, 5:11 PM

Hi Ray, Took me a while to find that, but I did! I should have mentioned that I was inheriting from "sale.view_order_form". Why is this one different, with the tree view being defined inline?

Jeff Beidler
on 2/11/15, 5:14 PM
1
Jeff Beidler
On 2/11/15, 5:09 PM

*sigh*

Tripped up by xpath again.  There was another instance of field "name" further up in the code.  It was hard to spot, since it doesn't display in the form at all, oddly enough.  In fact, it doesn't look like any of the stuff in "sale_view.xml" between the header and the tree tags gets displayed at all.  Not sure why, but I'd like to know!  Anyhow, this xpath expression got Odoo to override the correct field:

<xpath expr="//tree[@string='Sales Order Lines']/field[@name='name']" position="replace"/>

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

2 follower(s)

Stats

Asked: 2/11/15, 4:47 PM
Seen: 694 times
Last updated: 3/16/15, 8:10 AM