scripts: add script to copy acts of invoice data in invoice fields.
This commit is contained in:
parent
7aedc4d645
commit
0e771c3857
|
@ -0,0 +1,18 @@
|
||||||
|
import django.core.management
|
||||||
|
import calebasse.settings
|
||||||
|
|
||||||
|
django.core.management.setup_environ(calebasse.settings)
|
||||||
|
|
||||||
|
from calebasse.facturation.models import Invoice
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
for invoice in Invoice.objects.all():
|
||||||
|
if invoice.acts.count() > 0:
|
||||||
|
acts = invoice.acts.order_by('date')
|
||||||
|
invoice.first_tag = acts[0].get_hc_tag()
|
||||||
|
if not invoice.first_tag:
|
||||||
|
print 'Facture %s avec actes de type indetermine' % invoice.number
|
||||||
|
invoice.list_dates = '$'.join([act.date.strftime('%d/%m/%Y') for act in acts])
|
||||||
|
invoice.save()
|
||||||
|
else:
|
||||||
|
print 'Facture %s sans actes' % invoice.number
|
Reference in New Issue