Odoo Help


KeyError: "Field '0' does not exist in object 'browse_record(vehicule.line, 3)

on 7/18/14, 11:10 AM 959 views

Hi everybody,
I added some fields in the contract here is my code:

class vehicule_line (osv.osv):
    _name= "vehicule.line"
    _columns = {
        'nom': fields.char('nom',required=True, size=64),
        'matricule':fields.char('matricule',required=True, size=64),
        'date': fields.date('date d\'installation',required= True),
        'vehicule_id': fields.many2one('account.analytic.account', 'Analytic Account'),}

class account_analytic_account(osv.osv):
    _name = "account.analytic.account"
    _inherit = "account.analytic.account"
    _columns= {
        'vehicule_line_ids': fields.one2many('vehicule.line', 'vehicule_id', 'vehicule line'),

now i need to display those fields in the invoice generated from the contract, so here is what i did in the invoice

class vehicule_line(osv.osv):
    _name= "vehicule.line"

class account_invoice(osv.osv):
    _name = "account.invoice"
    _inherit = "account.invoice"
    _columns ={
            'flotte_id': fields.one2many('vehicule.line', 'vehicule_id', 'vehicule line'),
and i added in the contract this code:
           'flotte_id':contract.vehicule_line_ids or False,
the problem is that i get this error: KeyError: "Field '0' does not exist in object 'browse_record(vehicule.line, 3), please help what should i do?

About This Community

This platform 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.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)


Asked: 7/18/14, 11:10 AM
Seen: 959 times
Last updated: 3/16/15, 8:10 AM