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
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 ;-)