Revision 4ed25171

b/snf-cyclades-app/synnefo/quotas/__init__.py
180 180
    This function implements the Commission workflow, and must be called
181 181
    exactly after and in the same transaction that created/updated the
182 182
    resource. The workflow that implements is the following:
183
    0) Resolve previous unresolved commission if exists
183 184
    1) Issue commission and get a serial
184 185
    2) Store the serial in DB and mark is as one to accept
185 186
    3) Correlate the serial with the resource
......
189 190
    7) COMMIT!
190 191

  
191 192
    """
193
    previous_serial = resource.serial
194
    if previous_serial is not None and not previous_serial.resolved:
195
        if previous_serial.pending:
196
            msg = "Issuing commission for resource '%s' while previous serial"\
197
                  " '%s' is still pending." % (resource, previous_serial)
198
            raise Exception(msg)
199
        elif previous_serial.accept:
200
            accept_commissions(accepted=[previous_serial.serial])
201
        else:
202
            reject_commissions(rejected=[previous_serial.serial])
203
        previous_serial.resolved = True
204

  
192 205
    try:
193 206
        # Convert resources in the format expected by Quotaholder
194 207
        qh_resources = prepare_qh_resources(resource)

Also available in: Unified diff