تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
1 الرد
11965 أدوات العرض

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

أفضل إجابة

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 ?

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

الكاتب

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....

المنشورات ذات الصلة الردود أدوات العرض النشاط
4
ديسمبر 23
78620
1
مارس 15
5136
1
سبتمبر 18
10581
0
مارس 15
3932
0
مارس 15
3483