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.

7

Button not clickable in list view

By
Marc Cassuto
on 8/10/13, 8:15 PM 2,689 views

Hello Community,

I try to add a button in a list; the view appears, the button appears too but it is not clickable. It's like in a ghost state and I am unable to have the focus on it.

Here the code :

<record id="pkg-cfg_lines_tree_tree" model="ir.ui.view">
  <field name="name">pkg-cfg.tree</field>
  <field name="model">pkg-cfg_lines</field>
  <field name="view_mode">form</field>
  <field name="view_type">form</field>
  <field name="arch" type="xml">
    <tree string="Tree"  version="7.0" >
      <field name="pname" readonly="1" />
      <field name="chse" readonly="1"/>
      <button name="add_line" string="Add" type="object" icon="gtk-go-forward" />
    </tree>
  </field>
</record>

and the python code for the function :

   def add_line(self, cr, uid, ids, context):
        print "ENTER IN pkg-cfg_lines.add_line"
        return True

When I try to click on the button, the action is never called....

I also tried using a button with action type for the button :

< button name="%(add_line)d" string="Add" type="action" icon="gtk-go-forward" />

with the following action :

<record id="add_line" model="ir.actions.server">
    <field name="type">ir.actions.server</field>
    <field name="name">Testing</field>
    <field name="condition">True</field>
    <field name="state">code</field>
    <field name="model_id" ref="model_sale_configure_container"/>
    <field eval="5" name="sequence"/>
    <field name="code">action=obj.add_line(context=context)</field>                                                                                                       
</record>

Any ideas ?

Thanks in advance, Marc

You mentioned view_type and view_mode while displaying tree view.Is there need to mentioned it? Please try without those 2 lines.< button name="%(add_line)d" string="Add" type="action" icon="gtk-go-forward" /> This is generally used to call wizard from onclick of button

Vaibhav
on 8/12/13, 4:07 AM

Hello, Yes I also tried without these 2 lines => no success.

I know about my second try (with "%(add_line)d"), it is generally used to call a wizard but it is also a method to call an action ;-)

Marc Cassuto
on 8/12/13, 10:48 AM
0
Xsias
On 8/12/13, 6:51 AM

You need to be in the reading mode, not the edit mode of your entry. We have the same issue.

EDIT

Hi sven,

So I can you launch the view in reading mode ?

Did you manage to solve your issue ? Marc Cassuto (SFL)

Yes, we have made some dirty hack : In place of the button, we have put a checkbox (fields.boolean) with an onchange on it.

Hi sven,

So I can you launch the view in reading mode ?

Did you manage to solve your issue ?

Marc Cassuto
on 8/12/13, 10:51 AM

Yes, we have made some dirty hack : In place of the button, we have put a checkbox (fields.boolean) with an onchange on it.

Xsias
on 8/12/13, 11:15 AM

Hello Sven,

yes, we also thought about this solution... but this is a dirty one, I agree and there is some GUI glitch with it....

Marc Cassuto
on 8/12/13, 1:43 PM

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

0 follower(s)

Stats

Asked: 8/10/13, 8:15 PM
Seen: 2689 times
Last updated: 3/16/15, 8:10 AM