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

Add Custom Button To List View Header

By
Daniel Kauffman
on 8/31/15, 5:01 PM 2,452 views

In Odoo, when viewing a model in list view, buttons to "Create or Import" are usually displayed near the top of the page. Instead of these buttons, how would I display a custom button in this exact location on the page, when viewing my model in list view? I have a model that is read-only and would like to display a button to force synchronization of the model.

2

Axel Mendoza

--Axel Mendoza--
10205
| 7 7 8
Camaguey, Cuba
--Axel Mendoza--

DevOps - Full stack - Software Architect - Developer - Technology Integrator

I could help you to develop anything and solve complex problems based on technologies, integrations and tricky stuffs mostly in Python with OpenERP/Odoo, Zato, Django and many others frameworks programming languages and technologies.

I offers consulting services to anyone with an unanswered questions or needs for customizations. Think about it, maybe it's better to have an expert to solve your issues and projects than having a full time employee trying to understand what to do an how

Reach me at aekroft@gmail.com

Axel Mendoza
On 8/31/15, 7:21 PM

This require to develop an extension in the template and javascript widget, like this:

You need to include a template that insert the button like:

<t t-extend="ListView.buttons">
<t t-jquery="button.oe_list_add" t-operation="after">
<button class="oe_button oe_new_button oe_highlight" type="button">New Button</button>
</t>
</t>

Next you need to extend the widget ListView like this:

instance.web.ListView.include({
    load_list: function(data) {
if (this.$buttons) {
this.$buttons.find('.oe_new_button').click(this.proxy('do_new_button')) ;
}
},
do_new_button: function () {
//implement your clic logic here  
}
});

This is an example of course

Like so? https://www.odoo.com/documentation/8.0/howtos/web.html

Daniel Kauffman
on 8/31/15, 8:50 PM

see an example in the updated response

Axel Mendoza
on 9/1/15, 6:16 PM

Will this code add the button for *all* tree views?

Limitless Virtual Enterprise, Andre de Kock
on 9/2/15, 6:47 AM

Yes. But you could restrict the visibility using options for the template

Axel Mendoza
on 9/2/15, 6:49 AM
1

Emipro Technologies Pvt. Ltd.

--Emipro Technologies Pvt. Ltd.--
Tiny ERP Pvt Ltd
http://www.odoo.com
5975
| 6 7 8
Rajkot, India
--Emipro Technologies Pvt. Ltd.--

Being an emerging leader in IT market since 2011, Emipro Technologies Pvt. Ltd. has been providing a wide range of business solutions in Odoo & Magento. We are pleased to have a large pool of contented customers with our meticulous work in the domain of ERP & e-Commerce. A ray of relief & satisfaction to  our customers heart by our successful deployment in their organization, purely represents our success in Odoo platform. Hence, we take pride for being an Odoo partner with a vision of expanding our strategic alliances with our customers to offer them high value-added, trustworthy & cost effective solutions.

 

Since establishment, our business has span across 11 countries of the world. Our customers are companies of all sizes ranging from start-ups to large enterprises, who realize that they need a professional business solutions to generate revenue streams, establish proper communication channels or streamline business operations. Standing with strong determination of customer satisfaction, observing each minute detail of their business processes, providing proper guidance and moving forth to develop product accordingly adds our value and reliability among our customers. 

 

We are blessed with efficient, passionate & eclectic young developers who have come across almost all kinds of business profiles, working with full dedication, applying creativity & new features in existing modules and completing customer's projects successfully on predefined target. Our in-depth knowledge while giving business solutions in Odoo allows us to offer following services to our customers :

 

  • Consulting
  • Installation, Configuration & Customization
  • Training & Support
  • Maintenance
  • Upgradation
  • Documentation
  • Crafting community modules
  • Drafting videos on demand
  • Smart Apps development

We will be :) to welcome you @ www.emiprotechnologies.com to solve any kind of your business needs around Odoo. However we are just an inch away from you by email info@emiprotechnologies.com or a tweet to @EmiproTech

Emipro Technologies Pvt. Ltd.
On 9/1/15, 1:52 AM

Hello Daniel,

You can refer to account module & following files

  • /account/static/src/js/account_move_line_quickadd.js

  • /account/static/src/xml/account_move_line_quickadd.xml

This will not add the button at exact location where you wanted, but still can help you.

Hope this helps.

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

3 follower(s)

Stats

Asked: 8/31/15, 5:01 PM
Seen: 2452 times
Last updated: 9/3/15, 8:46 PM