Created
November 13, 2014 09:54
-
-
Save jakul/e020364c4b984b701f12 to your computer and use it in GitHub Desktop.
update pays pension field
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from jobs.models import * | |
import datetime | |
starts_on = datetime.date(2014,1,1) | |
# Update all ongoing jobs which don't have pays_pension but should | |
jobs = Job.objects.filter(status__in=[Job.STATUS_POSTED, Job.STATUS_FILLED, Job.STATUS_STARTED], pays_pension='').exclude(practice__pays_pension='') | |
for job in jobs: | |
job.pays_pension = job.practice.pays_pension | |
job.save() | |
# Update all jobs which are completed and don't have pays_pension but should | |
jobs = Job.objects.filter(pays_pension='', locum_invoiced=False, status='completed', starts_on__gte=starts_on).exclude(practice__pays_pension='').order_by('-starts_on') | |
for job in jobs: | |
job.pays_pension = job.practice.pays_pension | |
job.save() | |
# Do one manually | |
jj = Job.objects.get(id=10531) | |
jj.pays_pension | |
jj.pays_pension = jj.practice.pays_pension | |
jj.save() | |
# Get the invoice id for the "create trello card" announcement | |
jj.locuminvoice.id |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment