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.

0

ValueError: too many values to unpack

By
Anonymous
on 3/30/16, 11:05 PM 1,064 views

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

Jignesh Mehta

--Jignesh Mehta--
2081
| 6 4 8
Surat, India
--Jignesh Mehta--


Jignesh Mehta
On 3/31/16, 2:05 AM

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,

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

1 follower(s)

Stats

Asked: 3/30/16, 11:05 PM
Seen: 1064 times
Last updated: 3/31/16, 2:05 AM