'unlink()
Deletes the records of the current set
:raise AccessError: * if user has no unlink rights on the requested object
* if user tries to bypass access rules for unlink on the requested object
:raise UserError: if the record is default property for other records'

@api.multi
def unlink(self):

    if (not self):
        return True
    self.modified(self._fields)
    self._check_concurrency()
    self.check_access_rights('unlink')
    refs = [('%s,%s' % (self._name, i)) for i in self.ids]
    if self.env['ir.property'].search([('res_id', '=', False), ('value_reference', 'in', refs)]):
        raise UserError(_('Unable    to    delete    this    document    because    it    is    used    as    a    default    property'))
    self.env['ir.property'].search([('res_id', 'in', refs)]).unlink()
    self.delete_workflow()
    self.check_access_rule('unlink')
    cr = self._cr
    Data = self.env['ir.model.data'].sudo().with_context({})
    Values = self.env['ir.values']
    Attachment = self.env['ir.attachment']
    for sub_ids in cr.split_for_in_conditions(self.ids):
        query = ('DELETE    FROM    %s    WHERE    id    IN    %%s' % self._table)
        cr.execute(query, (sub_ids,))
        data = Data.search([('model', '=', self._name), ('res_id', 'in', sub_ids)])
        if data:
            data.unlink()
        refs = [('%s,%s' % (self._name, i)) for i in sub_ids]
        values = Values.search(['|', ('value', 'in', refs), '&', ('model', '=', self._name), ('res_id', 'in', sub_ids)])
        if values:
            values.unlink()
        query = 'SELECT    id    FROM    ir_attachment    WHERE    res_model=%s    AND    res_id    IN    %s'
        cr.execute(query, (self._name, sub_ids))
        attachments = Attachment.browse([row[0] for row in cr.fetchall()])
        if attachments:
            attachments.unlink()
    self.invalidate_cache()
    if (self.env.recompute and self._context.get('recompute', True)):
        self.recompute()
    _unlink.info('User    #%s    deleted    %s    records    with    IDs:    %r', self._uid, self._name, self.ids)
    return True
