Project

General

Profile

« Previous | Next » 

Revision 863f59f5

Added by Thomas Noël almost 12 years ago

b2: multiple batch in a B2 file

View differences:

calebasse/facturation/batches.py
13 13
        self.start_date = min(invoice.start_date for invoice in invoices)
14 14
        self.end_date = max(invoice.end_date for invoice in invoices)
15 15

  
16
    def __str__(self):
17
        return '%s pour %s (%d factures)' % (self.number, self.health_center, self.number_of_invoices)
18

  
16 19
def build_batches(invoicing):
17 20
    invoices = invoicing.invoice_set.order_by('number')
18 21
    prebatches = defaultdict(lambda:[])
19 22
    for invoice in invoices:
20 23
        prebatches[(invoice.health_center, invoice.batch)].append(invoice)
21 24
    batches_by_health_center = defaultdict(lambda:[])
25
    # FIXME / A REVOIR car il ne pas depasser 999 lignes par batches_by_health_center...
22 26
    for health_center, batch_number in sorted(prebatches.keys()):
23
        batches_by_health_center[health_center].append(Batch(batch_number,
27
        hc = health_center.hc_invoice or health_center
28
        batches_by_health_center[hc].append(Batch(batch_number,
24 29
            prebatches[(health_center, batch_number)]))
25 30
    return batches_by_health_center
26 31

  

Also available in: Unified diff