Last active
February 5, 2018 08:17
-
-
Save BlackPie/8b52b616371a940311eaf4edccc7d388 to your computer and use it in GitHub Desktop.
Invoice generation
This file contains 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
import datetime | |
#date_from = datetime.datetime(year=2017,day=1,month=10) | |
#date_to = datetime.datetime(year=2017,day=14,month=10) | |
date_from = datetime.datetime(year=2016,day=10,month=12) | |
InvoiceLine.objects.all().delete() | |
Invoice.objects.all().delete() | |
#contact = Contact.objects.filter(first_name='Justin', last_name='Ward').first() | |
#cc = CandidateContact.objects.filter(contact=contact).first() | |
#timesheets = TimeSheet.objects.filter(vacancy_offer__candidate_contact=cc).filter(shift_started_at__gte=date_from).filter(shift_started_at__lte=date_to) | |
#company = cc.vacancy_offers.all().first().shift.date.vacancy.provider_company | |
jobsite = Jobsite.objects.get(id='424aeeb3-efc5-4d1e-b67e-cba083a3b727') | |
company = Company.objects.get(id='7b85e014-2393-45ea-bf5f-371c3c2a07fd') | |
skill_uid = '177aa815-3c35-419b-a2d1-3d736311045d' | |
industry_uid = '0a0a4325-15e4-4b8f-b261-5c08f639c6b0' | |
skill = Skill.objects.get(id=skill_uid) | |
industry = Industry.objects.get(id=industry_uid) | |
industry_price_list = industry.industry_price_lists.first() | |
# this object was created manually | |
industry_price_list_rate = IndustryPriceListRate.objects.get(id='450e1906-a601-45c3-bb01-766b3c2e7540') | |
from r3sourcer.apps.hr.payment.invoices import InvoiceService | |
service = InvoiceService() | |
service.prepare(company, date_from) | |
invoice = Invoice.objects.filter(candidate=cc).first() |
This file contains 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
skill_uid = '' | |
industry_uid = '' | |
from decimal import Decimal | |
skill = Skill.objects.get(id=skill_uid) | |
industry = Industry.objects.get(id=industry_uid) | |
industry_price_list = industry.industry_price_lists.first() | |
IndustryPriceListRate.objects.create(skill=skill, industry_price_list=industry_price_list, hourly_rate=Decimal(10)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
InvoiceLine.objects.all().delete()
Invoice.objects.all().delete()