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

How do you change the label displayed in the search box?

By
Jeff Beidler
on 9/16/14, 6:46 PM 1,680 views

I would like to change the label that shows up when you start typing something in a search box. In particular, I'm looking at the search box on the Warehouse-->Traceability-->Serial Numbers page. I was confused by this page because the tree view contains the label "Serial Number", whereas the search box says, "Search Product Lots for: ...". I would like to make the search box text read, "Search Serial Number for: ...".

I created a module and inherited stock.search_product_lot_filter in my XML file, but nothing I have tried has had any effect on the text that shows up when you start typing in the search box.  What magic key am I missing?  I'll post code below.

This is the original code, defined in stock_view.xml.

        <record model="ir.ui.view" id="search_product_lot_filter">
            <field name="name">Production Lots Filter</field>
            <field name="model">stock.production.lot</field>
            <field name="arch" type="xml">
                <search string="Product Lots Filter">
                    <field name="name" string="Product Lots" filter_domain="['|','|',('name','ilike',self),('prefix','ilike',self),('ref','ilike',self)]"/>
                    <field name="date"/>
                    <filter icon="terp-check" name="available" string="Available" domain="[('stock_available', '&gt;', 0)]" help="Available Product Lots"/>
                    <field name="product_id"/>
                    <group expand="0" string="Group By...">
                        <filter string="Product" icon="terp-accessories-archiver" domain="[]" context="{'group_by':'product_id'}"/>
                    </group>
                </search>
            </field>
        </record>

And my inherited view:

        <record id="my_serial_number_search" model="ir.ui.view">
           <field name="name">My Serial Search Extension</field>
           <field name="model">stock.production.lot</field>
           <field name="inherit_id" ref="stock.search_product_lot_filter"/>
           <field name="arch" type="xml">
                <field name="name" position="attributes">
                    <attribute name="string">Serial Number</attribute>
                </field>
           </field>
        </record>

In addition to the above, I have also tried copy/pasting the original definition for "name" and just changing the "string" attribute.  Neither has worked.

0

Atchuthan - Technical Consultant, Sodexis Inc

--Atchuthan - Technical Consultant, Sodexis Inc--
3918
| 5 3 8
Puducherry, India
--Atchuthan - Technical Consultant, Sodexis Inc--
Passionate coder in Python/Odoo(formerly known as OpenERP).

Contact me via GMail: atchuthantu@gmail.com via Skype: atchuthan_skype
via Linkedin: http://in.linkedin.com/in/atchuthantu
Atchuthan - Technical Consultant, Sodexis Inc
On 9/17/14, 1:29 AM

The syntax for Inheriting the Search view is correct. 

For any changes in XML, we need to upgrade the module to update the changes to the OpenERP.
Also, if we add a field through PY file, then server needs to be restarted and module needs to be upgraded.
If function is modified in PY file, then server needs to be restarted but no need to upgrade the module

Every time I make a change to a module, I restart the OpenERP server with the -u module_name and -d db_name parameters, to make sure that everything is updated.

Jeff Beidler
on 9/17/14, 11:35 AM

Well, I got it to work. Not sure why it wasn't updating when I restarted the server from the command line with the -u option, but it seems to have not made a difference. In addition to the above code, I had also added '' to the XML, but even after restarting the server, this wasn't reflected in the "Sequence" column. I actually had to go to Settings-->Installed Modules and manually click the "Upgrade" button. Isn't that what the -u and -d options are supposed to do for you, when you start the server from the command line?

Jeff Beidler
on 9/17/14, 11:53 AM
0

Ivan

--Ivan--
3210
| 5 3 6
Jakarta, Indonesia
--Ivan--
Ivan
On 9/17/14, 12:42 AM

Have you upgraded/installed the module that you are changing the string with?

Yes, every time I make a change to a module, I restart the OpenERP server with the -u module_name and -d db_name parameters, to make sure that everything is updated.

Jeff Beidler
on 9/17/14, 11:35 AM

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: 9/16/14, 6:46 PM
Seen: 1680 times
Last updated: 3/16/15, 8:10 AM