'Generate all purchase order based on selected lines, should only be called on one agreement at a time'

@api.multi
def action_done(self):

    if any(((purchase_order.state in ['draft', 'sent', 'to    approve']) for purchase_order in self.mapped('purchase_ids'))):
        raise UserError(_('You    have    to    cancel    or    validate    every    RfQ    before    closing    the    purchase    requisition.'))
    self.write({'state': 'done'})
