Commit 7adefac3 authored by Claire Zuliani's avatar Claire Zuliani

feature: add djangoldp_project to module #3

parent 6d2472bc
# -*- coding: utf-8 -*-
# Generated by Django 1.11.18 on 2019-01-17 02:15
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('djangoldp_project', '0002_move_jabber'),
('djangoldp_invoices', '0003_auto_20190114_1630'),
]
operations = [
migrations.AddField(
model_name='clientinvoice',
name='customer',
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, to='djangoldp_project.Customer'),
),
migrations.AddField(
model_name='clientinvoice',
name='project',
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, to='djangoldp_project.Project'),
),
]
# -*- coding: utf-8 -*-
from django.conf import settings
from django.db import models
from djangoldp_project.models import Customer
from djangoldp_project.models import Project
from django.db.models import Sum
import datetime
from decimal import Decimal
......@@ -40,8 +42,8 @@ class FreelanceInvoice(models.Model):
class ClientInvoice(models.Model):
# customer = models.ForeignKey('xxx.Client', on_delete=models.CASCADE)
# project = models.ForeignKey('xxx.Project', on_delete=models.CASCADE)
customer = models.ForeignKey(Customer, on_delete=models.DO_NOTHING, null=True)
project = models.ForeignKey(Project, on_delete=models.DO_NOTHING, null=True)
STATES = (
('pending', 'en attente'),
('paid', 'réglée')
......
......@@ -9,9 +9,9 @@ from .models import Task
urlpatterns = [
url(r'^freelance-invoices/', LDPViewSet.urls(model=FreelanceInvoice)),
url(r'^client-invoices/', LDPViewSet.urls(model=ClientInvoice,
nested_fields=["batches"],
nested_fields=["batches", "project", "customer"],
fields=["@id", "identifier", "title", "state", "htAmount", "tvaRate", "invoicingDate",
"tvaAmount", "ttcAmount", "batches"]
"tvaAmount", "ttcAmount", "batches", "project", "customer"]
)),
url(r'^batches/', LDPViewSet.urls(model=Batch,
nested_fields=["tasks"],
......
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