Odoo Help


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.


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

on 7/18/14, 11:10 AM 617 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?

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)


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