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'),}
vehicule_line()
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'),
}
account_analytic_account()
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"
_inherit="vehicule.line"
vehicule_line()
class account_invoice(osv.osv):
_name = "account.invoice"
_inherit = "account.invoice"
_columns ={
'flotte_id': fields.one2many('vehicule.line', 'vehicule_id', 'vehicule line'),
}
account_invoice()
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?