This question has been flagged
1 Reply
3259 Views

Hi, Is it possible to put a on_change inside the py file? I have a one2many field

'target_trainees' : fields.one2many('training.registeration','target_employee_id','Target Trainees'),

and the related class is

class training_registration(osv.osv): _name = 'training.registeration'

def onchange_target_employee(self,cr,uid,ids,target_employee_id,context=None):
   pass

_columns = {
            'target_employee_id' : fields.many2one('hr.employee','Employee'),
            'email': fields.char('Email', size=64,readonly=True),
            'phone': fields.char('Phone', size=64,readonly=True),
            'state': fields.selection([('draft', 'Unconfirmed'),
                                ('cancel', 'Cancelled'),
                                ('open', 'Confirmed'),
                                ('done', 'Attended')], 'Status',
                                track_visibility='onchange',
                                size=16, readonly=True),
            }

I do not include the training_registration class columns directly in my xml view. When i add records to the one2many fields I get a popup to fill in the fields of the training_registration class. What i want is to call an on_change event when i select the employee and put in his email and mail accordingly though the on_change method.

How can i do that?

Avatar
Discard
Best Answer

See similar ask.

Avatar
Discard