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

[SOLVED]: How to add custom action button into product_template_form_view?

By
Dr Obx
on 3/23/16, 8:02 AM 655 views

I would like to add button into the view as in title.

There is a button box div and myButton must be placed inside of this box. 

...

<field name="" position="inside">

<button name="pick_one" class="oe_inline oe_stat_button" type="object" style="background:rgba(46, 210, 162,0.2);" string="- 1" icon="fa-sign-out" attrs="{'invisible':['|',('type', '=', 'service')]}"/>

</field>

...

How should I add it ?


1
Nilesh Sheliya
On 3/23/16, 8:36 AM

To add the button inside div,Please add the below code,


<xpath expr="//div[@name='buttons']" position="inside"> 

<button name="pick_one" class="oe_inline oe_stat_button" type="object" style="background:rgba(46, 210, 162,0.2);" string="- 1" icon="fa-sign-out" attrs="{'invisible':['|',('type', '=', 'service')]}"/>

</xpath>

Awesome, thank you Nilesh :) AssertionError: Did not expect element xpath there, line 9 Where should I add it in xml file ? to avoid this error ?

Dr Obx
on 3/23/16, 8:43 AM

OK, i got it :)

Dr Obx
on 3/23/16, 8:47 AM

Done :)

Dr Obx
on 3/23/16, 8:50 AM

By any chance can I decide where to put it I mean above or below existing buttons ?

Dr Obx
on 3/23/16, 9:55 AM

Yes, you can decide where to add button. Inside means Button added after the other existing buttons. If you need to add button after/before particular existing button, then you have to use xpath like(example) <xpath expr="//div[@name='buttons']/button[@name='action_open_quants']" position="after"> You can use position after, before or inside. 'action_open_quants' is the name of the button.

Nilesh Sheliya
on 3/23/16, 10:09 AM

Got it, THANK YOU! Nilesh

Dr Obx
on 3/23/16, 11:05 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: 3/23/16, 8:02 AM
Seen: 655 times
Last updated: 3/23/16, 9:54 AM