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

Too many values to unpack?

By
Uppili Arivukkannu
on 6/23/16, 10:08 AM 321 views

I have create a new module which has more number of fields I called this in python as a column


from openerp.osv import fields, osv

class autobuy_fields(osv.osv):

_name = "autobuy.fields"

_description = "autobuy fields"

_columns = {

'name': fields.char('Source'),

'created':fields.datetime('Created'),

'vin':fields.char('Vin'),

'year':fields.selection([('2012'), ('2013'), ('2014')]),

'make':fields.selection([('Jeep'), ('SUV'), ('TUV')]),

'model':fields.selection([('Model1'), ('Model2'), ('Mopdel3')]),

'color':fields.char('Color'),

'mileage':fields.float('Purchased Mileage'),

'boffer':fields.float('AutoBuy Offer'),

'coffer':fields.float('Customer Offer'),

'soffer':fields.float('Second AutoBuy Offer'),

'amount':fields.float('Purchase Amount'),

'price':fields.float('Asking Price'),

'aoffer':fields.float('AutoTrader Offer'),

'sroffer':fields.float('SR Buyer Offer'),

'samount':fields.float('Sold Amount'),

'fname':fields.char('First Name'),

'lname':fields.char('Last Name'),

'cname':fields.char('Co-Owner Name'),

'address':fields.char('Address'),

'city':fields.char('City'),

'state':fields.char('State'),

'zip':fields.integer('Zip'),

'cphone':fields.integer('Cell Phone'),

'hphone':fields.integer('Home Phone'),

'email':fields.integer('Email'),

'pdate':fields.date('Purchase Date'),

'udate':fields.date('Pickup Date'),

'stock':fields.char('Stock No'),

}


It shows error as "too many columns to unpack" If I give only 8 fields it does not shows error If I give more than 8 values it shows the error.

How can I solve this or it only take 8 fields?

the error is not number of fields but the definition of selection field.

Yogesh
on 6/23/16, 5:47 PM
1
Yogesh
On 6/23/16, 5:44 PM

The error is because of the wrong definition of selection field. It is supposed to be a list of tuples. 

try changing your selection field definition like below

'year':fields.selection([('2012','2012'), ('2013','2013), ('2014','2014')], string='Year'),
'make':fields.selection([('j','Jeep'), ('s','SUV'), ('t','TUV')], string='Make'),
'model':fields.selection([('1','Model1'), ('2','Model2'), ('3','Mopdel3')], string='Model'), 


for more info on selection field follow theDoc

Thanks for your replay

Uppili Arivukkannu
on 6/24/16, 1:18 AM

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: 6/23/16, 10:08 AM
Seen: 321 times
Last updated: 6/24/16, 1:18 AM