I'm trying to get the partner_id upon updating the form, unfortunately I can't capture it. I've added a def write function in order to modify the updating. What I wanted to do is, when the form is submitted and the field "state" is equals to approved, it will create another record at other table/object. But I can't seem to make it work and capture the partner id using vals['partner_id'] which is also in the form..Please help and thanks in advance
class res_processing_request(osv.osv):
    _name = 'res.processing.request'
    _description = 'res.processing.request'
    _columns = {
        'date': fields.datetime('Date Requested', required=True),
        'partner_id': fields.many2one('res.partner', 'Client', required=True),
        'status': fields.many2one('res.partner.application.status', 'Status'),
        'name': fields.char('Request Name', size=255, required=True),
        'requestor_id': fields.many2one('res.users', 'Requested By', required=True),
        'approver_id': fields.many2one('res.users', 'Approved By'),
        'state': fields.selection([
            ('For Approval', 'For Approval'),
            ('On-hold', 'On-hold'),
            ('Approved', 'Approved'),
        ], 'State', required=True),
        'active': fields.boolean('Active'),
    }
    _defaults = {
        'active': lambda *a: 't',
        'state': lambda *a: 'For Approval',
    }
    def write(self, cr, uid, ids, vals, context=context):
        if vals['state'] == 'Approved':
            # processing_request = self.read(cr, uid, ids, context=context)
            application_history_data = {
                'create_uid' : uid,
                'create_date' : time.strftime('%Y-%m-%d %H:%M:%S'),
                'status' : 348,
                'user_id' : uid,
                'email' : '',
                'subject' : '',
                'date' : time.strftime('%Y-%m-%d %H:%M:%S'),
                'partner_id' : vals['partner_id'],
                'visible' : 1
            }
self.pool.get('res.partner.application.history').create(cr, uid, application_history_data)
return super(res_processing_request, self).write(cr, uid, ids, vals, context)
    def onchange_status(self, cr, uid, ids, status_id, context={}):
        if status_id:
            status = pooler.get_pool(cr.dbname).get('res.partner.application.status').browse(cr, uid, status_id, context)
            return {'value': { 'name': status.name }}
res_processing_request()
 
                        
Weird. It should be there. Maybe the xml file associated with the model is the erroneous one?