'When posting an attachment (new or not), convert the virtual ids in real ids.'

@api.multi
def write(self, vals):

    if isinstance(vals.get('res_id'), basestring):
        vals['res_id'] = get_real_ids(vals.get('res_id'))
    return super(Attachment, self).write(vals)
