Commit 33fa4b66 authored by Claire Zuliani's avatar Claire Zuliani

Add freelance invoice model

parent 86794592
from django.contrib import admin
from guardian.admin import GuardedModelAdmin
from .models import ClientInvoice
from .models import FreelanceInvoice
admin.site.register(ClientInvoice)
admin.site.register(FreelanceInvoice)
# -*- coding: utf-8 -*-
# Generated by Django 1.11.16 on 2018-11-12 19:31
from __future__ import unicode_literals
import datetime
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('djangoldp_invoices', '0002_auto_20181112_1912'),
]
operations = [
migrations.CreateModel(
name='FreelanceInvoice',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('freelanceFullname', models.CharField(max_length=255)),
('identifier', models.CharField(max_length=255)),
('title', models.CharField(max_length=255)),
('htAmount', models.DecimalField(decimal_places=2, max_digits=11)),
('tvaRate', models.DecimalField(decimal_places=2, max_digits=4)),
('creationDate', models.DateField(default=datetime.date.today)),
('modificationDate', models.DateField(default=datetime.date.today)),
('invoicingDate', models.DateField(default=datetime.date.today)),
('uploadUrl', models.CharField(max_length=255)),
],
options={
'permissions': (('view_freelance_invoice', 'Read'), ('control_freelance_invoice', 'Control')),
},
),
]
......@@ -25,3 +25,30 @@ class ClientInvoice(models.Model):
def __str__(self):
return '{} ({})'.format(self.identifier, self.title)
class FreelanceInvoice(models.Model):
# customer = models.ForeignKey(User, on_delete=models.CASCADE)
# provider = models.ForeignKey(User, on_delete=models.CASCADE)
STATES = (
('pending', 'en attente'),
('paid', 'réglée')
)
freelanceFullname = models.CharField(max_length=255)
identifier = models.CharField(max_length=255)
title = models.CharField(max_length=255)
# state = models.CharField(max_length=1, choices=STATES, default = 'pending')
htAmount = models.DecimalField(max_digits=11, decimal_places=2)
tvaRate = models.DecimalField(max_digits=4, decimal_places=2)
creationDate = models.DateField(default = datetime.date.today)
modificationDate = models.DateField(default = datetime.date.today)
invoicingDate = models.DateField(default = datetime.date.today)
uploadUrl = models.CharField(max_length=255)
class Meta:
permissions = (
('view_freelance_invoice', 'Read'),
('control_freelance_invoice', 'Control'),
)
def __str__(self):
return '{} ({} / {})'.format(self.freelanceFullname, self.identifier, self.title)
\ No newline at end of file
......@@ -2,7 +2,9 @@ from django.conf.urls import url, include
from django.conf import settings
from djangoldp.views import LDPViewSet
from .models import ClientInvoice
from .models import FreelanceInvoice
urlpatterns = [
url(r'^client-invoices', LDPViewSet.urls(model=ClientInvoice)),
url(r'^freelance-invoices', LDPViewSet.urls(model=FreelanceInvoice)),
]
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment