Commit 26ccca87 authored by Matthieu Fesselier's avatar Matthieu Fesselier

feature: package component #5

parent 7adefac3
Pipeline #2126 passed with stage
in 27 seconds
---
image: python:3.6
stages:
- test
- release
test:
stage: test
script:
- echo 'Make your tests here !'
except:
- master
tags:
- sib
publish:
stage: release
before_script:
- git config user.name "${GITLAB_USER_NAME}"
- git config user.email "${GITLAB_USER_EMAIL}"
- git remote set-url origin "https://gitlab-ci-token:${GL_TOKEN}@git.happy-dev.fr/${CI_PROJECT_PATH}.git"
- pip install git+https://github.com/plup/python-semantic-release
- pip install sib-commit-parser
script:
- semantic-release publish
only:
- master
tags:
- sib
......@@ -5,9 +5,9 @@ It aims at enabling people with little development skills to serve their own dat
# Models
## ClientInvoice
## CustomerInvoice
An invoice generated by , for one of its client.
An invoice generated by , for one of its customer.
## FreelanceInvoice
......
__version__ = '0.0.0'
name = "djangoldp_invoice"
from django.contrib import admin
from guardian.admin import GuardedModelAdmin
from .models import ClientInvoice
from .models import CustomerInvoice
from .models import FreelanceInvoice
from .models import Batch
from .models import Task
admin.site.register(ClientInvoice)
admin.site.register(CustomerInvoice)
admin.site.register(FreelanceInvoice)
admin.site.register(Batch)
admin.site.register(Task)
......@@ -2,4 +2,4 @@ from django.apps import AppConfig
class DjangoldpInvoicesConfig(AppConfig):
name = 'djangoldp_invoices'
name = 'djangoldp_invoice'
......@@ -29,7 +29,7 @@ class Migration(migrations.Migration):
},
),
migrations.CreateModel(
name='ClientInvoice',
name='CustomerInvoice',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('identifier', models.CharField(max_length=255)),
......@@ -71,7 +71,7 @@ class Migration(migrations.Migration):
('htAmount', models.DecimalField(decimal_places=2, max_digits=11)),
('creationDate', models.DateField(auto_now_add=True)),
('modificationDate', models.DateField(auto_now=True)),
('batch', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='djangoldp_invoices.Batch')),
('batch', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='djangoldp_invoice.Batch')),
],
options={
'permissions': (('view_batch', 'Read'), ('control_batch', 'Control')),
......@@ -80,6 +80,6 @@ class Migration(migrations.Migration):
migrations.AddField(
model_name='batch',
name='invoice',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='djangoldp_invoices.ClientInvoice'),
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='djangoldp_invoice.CustomerInvoice'),
),
]
......@@ -9,18 +9,18 @@ import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('djangoldp_invoices', '0001_initial'),
('djangoldp_invoice', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='batch',
name='invoice',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='batches', to='djangoldp_invoices.ClientInvoice'),
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='batches', to='djangoldp_invoice.CustomerInvoice'),
),
migrations.AlterField(
model_name='task',
name='batch',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='tasks', to='djangoldp_invoices.Batch'),
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='tasks', to='djangoldp_invoice.Batch'),
),
]
......@@ -8,7 +8,7 @@ from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('djangoldp_invoices', '0002_auto_20181206_1856'),
('djangoldp_invoice', '0002_auto_20181206_1856'),
]
operations = [
......@@ -17,7 +17,7 @@ class Migration(migrations.Migration):
name='htAmount',
),
migrations.RemoveField(
model_name='clientinvoice',
model_name='customerinvoice',
name='htAmount',
),
migrations.AlterField(
......
......@@ -10,17 +10,17 @@ class Migration(migrations.Migration):
dependencies = [
('djangoldp_project', '0002_move_jabber'),
('djangoldp_invoices', '0003_auto_20190114_1630'),
('djangoldp_invoice', '0003_auto_20190114_1630'),
]
operations = [
migrations.AddField(
model_name='clientinvoice',
model_name='customerinvoice',
name='customer',
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, to='djangoldp_project.Customer'),
),
migrations.AddField(
model_name='clientinvoice',
model_name='customerinvoice',
name='project',
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.DO_NOTHING, to='djangoldp_project.Project'),
),
......
......@@ -41,7 +41,7 @@ class FreelanceInvoice(models.Model):
class ClientInvoice(models.Model):
class CustomerInvoice(models.Model):
customer = models.ForeignKey(Customer, on_delete=models.DO_NOTHING, null=True)
project = models.ForeignKey(Project, on_delete=models.DO_NOTHING, null=True)
STATES = (
......@@ -76,7 +76,7 @@ class ClientInvoice(models.Model):
# Lot =========================================================
class Batch(models.Model):
invoice = models.ForeignKey(ClientInvoice, on_delete=models.CASCADE, related_name='batches')
invoice = models.ForeignKey(CustomerInvoice, on_delete=models.CASCADE, related_name='batches')
title = models.CharField(max_length=255)
creationDate = models.DateField(auto_now_add=True)
modificationDate = models.DateField(auto_now=True)
......
from django.conf.urls import url, include
from django.conf import settings
from djangoldp.views import LDPViewSet
from .models import ClientInvoice
from .models import CustomerInvoice
from .models import FreelanceInvoice
from .models import Batch
from .models import Task
urlpatterns = [
url(r'^freelance-invoices/', LDPViewSet.urls(model=FreelanceInvoice)),
url(r'^client-invoices/', LDPViewSet.urls(model=ClientInvoice,
url(r'^customer-invoices/', LDPViewSet.urls(model=CustomerInvoice,
nested_fields=["batches", "project", "customer"],
fields=["@id", "identifier", "title", "state", "htAmount", "tvaRate", "invoicingDate",
"tvaAmount", "ttcAmount", "batches", "project", "customer"]
......
[metadata]
name = djangoldp_invoice
version = attr: djangoldp_invoice.__version__
url = https://git.happy-dev.fr/startinblox/djangoldp-packages/djangoldp_invoices
author = Startin'blox
author_email = claire@happy-dev.fr
description = djangoldp package for invoicing data models
license = MIT
[options]
packages = find:
install_requires =
djangoldp~=0.5
[options.extras_require]
dev =
factory_boy>=2.11.0
[semantic_release]
version_source = tag
version_variable = djangoldp_invoice/__init__.py:__version__
commit_parser = commit_parser.parse
#!/usr/bin/env python
from setuptools import setup
setup()
from django.shortcuts import render
# Create your views here.
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