Skip to Content
Menu
This question has been flagged
3 Replies
23437 Views

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

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

Avatar
Discard

Can you post your code ?

Best Answer

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,

 

Avatar
Discard
Author Best Answer

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()

Avatar
Discard