Skip to Content
Meniu
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
Această întrebare a fost marcată
1 Răspunde
12605 Vizualizări

I created a new object for alternate model in product, but everytime I access products - it returns an error: (I'm using new api)

Error

ValueError: too many values to unpack

Python file

from openerp import fields, models

class ProductAlternateModel(models.Model):
    _name = 'product.alternate.model'

    #fields

class product_product(models.Model):
    _inherit = 'product.product'

    alternate_model_ids = fields.Many2many('product.alternate.model')

XML File (Product Form)

<xpath expr="//field[@name='lst_price']" position="after">
                <notebook>
                    <page string="Alternate Model">
                        <field name="alternate_model_ids"/>
                    </page>
                </notebook>
            </xpath>
Imagine profil
Abandonează
Cel mai bun răspuns

Hello Anonymous,


Your Many2many field is define wrong.

Try this :-

alternate_model_ids = fields.Many2many('product.alternate.model', 'product_model', 'alternate_id', 'alternate_model_id', 'Alternate Model')


Hope this will helps you.

Thanks,

Imagine profil
Abandonează
Related Posts Răspunsuri Vizualizări Activitate
2
mai 25
1357
0
dec. 24
1510
1
mar. 24
2567
2
ian. 24
2892
0
nov. 23
1645