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

how i can resolve this error "invf = comodel._fields[self.inverse_name] KeyError: 'driver_id' odoo"

By
tarek
on 4/8/16, 6:17 AM 728 views

'driver_id': fields.many2one('hr.employee','driver'),

'planning_ids': fields.one2many('asc.driver.planning', 'driver_id', 'planning driver'),

Can you post your code ?

Jignesh Mehta
on 4/9/16, 12:07 AM
5

Jignesh Mehta

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


Jignesh Mehta
On 4/9/16, 3:05 AM

Hello Tatek,


Try this :-

class asc_hr_employee(osv.osv):

    _inherit = 'hr.employee'

    _columns = {

        'planning_ids': fields.one2many('asc.planning.line', 'driver_id', 'Driver'),

         #Others Columns

    }


class asc_driver_planning(osv.osv):

    _name = "asc.planning.line"

    _description = "planning driver"

    _columns = {

        'driver_id': fields.many2one('hr.employee','Driver'),

         #Other Columns

     }


Thanks,

 

0
tarek
On 4/9/16, 2:25 AM

class asc_hr_employee(osv.osv):

_inherit = 'hr.employee'

 

_columns = {

'planing_line': fields.one2many('asc.rental.contract','rental_employ_id','planning driver'),

'is_driver': fields.boolean(' is driver'),

'date_start':fields.function(_get_date,'date debut',type='datetime'),

'date_end':fields.function(_get_date,'date fin',type='datetime'),

}

_default= {

'is_driver':False,

}

asc_hr_employee()

----------------------------------------

class asc_driver_planning(osv.osv):

_name = "asc.planning.line"

_description = "planning driver"

columns = {

'driver_id': fields.many2one('hr.employee','driver'),

'name': fields.char('Name', size=64,readonly=True),

'start_date': fields.datetime('start date',required=True),

'end_date': fields.datetime('end date', required=True ) ,

'state': fields.selection([

('draft', 'Reservation'),

('done', 'Done'),

('cancel', 'Cancelled'),

]),

}

asc_driver_planning()

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: 4/8/16, 6:17 AM
Seen: 728 times
Last updated: 4/9/16, 3:07 AM