Revision cceadca8

b/snf-quotaholder-app/quotaholder_django/quotaholder_app/callpoint.py
291 291
                                   flags)
292 292
        return rejected
293 293

  
294
    def _check_pending(self, entity=None):
295
        serials = []
296
        try:
297
            cs = Commission.objects.filter(entity=entity)
298
            serials = [c.serial for c in cs]
299
        except Commission.DoesNotExist:
300
            pass
294
    def _check_pending(self, entity, resource):
295
        cs = Commission.objects.filter(entity=entity)
296
        cs = [c for c in cs if c.provisions.filter(resource=resource)]
297
        as_target = [c.serial for c in cs]
301 298

  
302
        try:
303
            ps = Provision.objects.filter(entity=entity)
304
            serials += [p.serial.serial for p in ps]
305
        except Provision.DoesNotExist:
306
            pass
307
        return serials
299
        ps = Provision.objects.filter(entity=entity, resource=resource)
300
        as_source = [p.serial.serial for p in ps]
301

  
302
        return as_target + as_source
308 303

  
309 304
    def _actual_quantity(self, holding):
310 305
        hp = holding.policy
......
340 335
                append(idx)
341 336
                continue
342 337

  
343
            if self._check_pending(entity):
338
            if self._check_pending(entity, resource):
344 339
                append(idx)
345 340
                continue
346 341

  

Also available in: Unified diff