I want to add a new search button to the odoo control panel view. I am using odoo V11 and the screenshot of the view is pasted here so you can understand what I am talking about. I want to add this button next to the search box indicated as a black circle in the image. The new search box will provide Spatial data search function. That is why I want to create a new search button instead of using the existing search options. Thanks
0
votes
It is about programming. Odoo uses XML/template to generate the view and choose which JS file to load. The problem is that the odoo email list is not very active. That is why I ask here.
– Jerry Zhang
@JerryZhang Have you used the Developer Mode at all? It allows you to see a lot of additional information, including which views, actions, etc. are used to load whichever view you are looking at. It can be enabled in the middle/bottom right section of the Settings app and it adds a small "bug" icon into the top-right side of the navigation menu (near your user name). You'll probably want to use the "Edit Form View" option in that menu.
– travisw
I just find out base.xml controls the control panel view. But I will do what you said first because possibly it is an easy approach. Thanks
– Jerry Zhang
So you've already found the template, but don't know how to extend/change it? Maybe you should change your question then ;-)
– CZoellner
Don't forget to answer yourself, if possible.
– CZoellner
1 Answers
0
votes
I would not complicate myself adding that button, just use the existing search box to enter the data to search and add a new option "Spatial data" to the menu shown when you enter text. That is added with xml, similar to this example taken from the bank views:
<field name="arch" type="xml">
<search string="Bank Accounts">
<field name="bank_name" filter_domain="['|', ('bank_name','ilike',self), ('acc_number','ilike',self)]" string="Bank Name"/>
<field name="company_id" invisible="context.get('company_hide', True)"/>
<field name="partner_id"/>
</search>
</field>
You may also need to do some coding in the .py files if it is not enough with just the domain filter, in that case override the name_search method of the model. You have many examples of that in the Odoo code itself.