Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
3 ตอบกลับ
10918 มุมมอง

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.

Can button strings be empty (in v8)?

ผู้เขียน

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

คำตอบที่ดีที่สุด

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

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

Hello,

 

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

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

อวตาร
ละทิ้ง
ผู้เขียน คำตอบที่ดีที่สุด

(previous answer converted as comment)

Hello Thierry Godin,

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

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
1
พ.ค. 24
1974
2
มิ.ย. 22
2878
0
ก.ค. 17
4485
1
ก.พ. 17
5703
2
ก.ค. 15
6734