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.

1

Treeview button error : dict.field.attrs.modifiers is undefined

By
Risbourg Guillaume
on 6/27/14, 5:29 AM 2,689 views

Hi,

I've got a tree view like this :

<record model="ir.ui.view" id="module_tree">
            <field name="name">module.tree</field>
            <field name="model">module</field>
            <field name="arch" type="xml">
                <tree string="Invoices" create="false" delete="false" edit="false">
                    <field name="partner_id" groups="base.group_user"/>
                    <field name="invoice_id"/>
                    <button name="look_invoice" string="" icon="gtk-go-forward" help="See invoice" type="object"/>
                </tree>
            </field>
        </record>

When i take out the button from the tree view, all display correctly. But if i put the button i've got this error :

Error: QWeb2 - template['TreeView']: Runtime Error: TypeError: dict.field.attrs.modifiers is undefined

My python function related to the button :

def look_invoice(self,cr,uid,ids,context=None):
        context = context or {}
        invoice_id = self.read(cr,uid, ids[0], ['invoice_id'])['invoice_id']
        if invoice_id:
            return {
                'type': 'ir.actions.act_window',
                'name': 'Invoice',
                'res_model': 'module',
                'res_id': invoice_id[0]
                'view_type': 'form',
                'view_mode': 'form',
                'nodestroy': True,
            }
        return False

Does somebody got any idea of where is the problem please ?

 

Hello Jagdish, I've try your code and i've got always the error.

Risbourg Guillaume
on 7/2/14, 2:42 AM

Can button strings be empty (in v8)?

René Schuster
on 7/2/14, 3:30 AM

Even if i put a string to the button, i get the error.

Risbourg Guillaume
on 7/2/14, 3:35 AM
0

Jagdish Panchal

--Jagdish Panchal--
2674
| 5 3 6
Gandhinagar, India
--Jagdish Panchal--

OpenERP Developer

Jagdish Panchal
On 6/27/14, 5:38 AM

Hi

Try this code

def look_invoice(self,cr,uid,ids,context=None):
        context = context or {}
        invoice_id = self.read(cr,uid, ids, ['invoice_id'])
        if invoice_id:
            return {
                'type': 'ir.actions.act_window',
                'name': 'Invoice',
                'res_model': 'module',
                'res_id': invoice_id[0],
                'view_type': 'form',
                'view_mode': 'form',
                'nodestroy': True,
            }
        return False

0

Thierry Godin

--Thierry Godin--
1516
| 8 7 8
Collegien, France
--Thierry Godin--

..

Thierry Godin
On 6/27/14, 8:29 AM

Hello,

 

Just add version="7.0" to the tree statement :

<tree string="Invoices" create="false" delete="false" edit="false" version="7.0">

0
Risbourg Guillaume
On 7/2/14, 2:43 AM

(previous answer converted as comment)

Hello Thierry Godin,

I've try your code but the error is still there...

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: 6/27/14, 5:29 AM
Seen: 2689 times
Last updated: 5/14/16, 4:32 PM