mirror of https://gitlab.federez.net/re2o/re2o
10 changed files with 499 additions and 112 deletions
@ -0,0 +1,72 @@ |
|||
# -*- coding: utf-8 -*- |
|||
# Generated by Django 1.10.7 on 2018-07-21 20:01 |
|||
from __future__ import unicode_literals |
|||
|
|||
from django.db import migrations, models |
|||
import django.db.models.deletion |
|||
import re2o.field_permissions |
|||
import re2o.mixins |
|||
|
|||
|
|||
def reattribute_ids(apps, schema_editor): |
|||
Facture = apps.get_model('cotisations', 'Facture') |
|||
BaseInvoice = apps.get_model('cotisations', 'BaseInvoice') |
|||
|
|||
for f in Facture.objects.all(): |
|||
base = BaseInvoice.objects.create(id=f.pk, date=f.date) |
|||
f.baseinvoice_ptr = base |
|||
f.save() |
|||
|
|||
class Migration(migrations.Migration): |
|||
|
|||
dependencies = [ |
|||
('cotisations', '0030_custom_payment'), |
|||
] |
|||
|
|||
operations = [ |
|||
migrations.CreateModel( |
|||
name='BaseInvoice', |
|||
fields=[ |
|||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), |
|||
('date', models.DateTimeField(auto_now_add=True, verbose_name='Date')), |
|||
], |
|||
bases=(re2o.mixins.RevMixin, re2o.mixins.AclMixin, re2o.field_permissions.FieldPermissionModelMixin, models.Model), |
|||
), |
|||
migrations.CreateModel( |
|||
name='CustomInvoice', |
|||
fields=[ |
|||
('baseinvoice_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='cotisations.BaseInvoice')), |
|||
('recipient', models.CharField(max_length=255, verbose_name='Recipient')), |
|||
('payment', models.CharField(max_length=255, verbose_name='Payment type')), |
|||
('address', models.CharField(max_length=255, verbose_name='Address')), |
|||
('paid', models.BooleanField(verbose_name='Paid')), |
|||
], |
|||
bases=('cotisations.baseinvoice',), |
|||
options={'permissions': (('view_custom_invoice', 'Can view a custom invoice'),)}, |
|||
), |
|||
migrations.AddField( |
|||
model_name='facture', |
|||
name='baseinvoice_ptr', |
|||
field=models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to='cotisations.BaseInvoice', null=True), |
|||
preserve_default=False, |
|||
), |
|||
migrations.RunPython(reattribute_ids), |
|||
migrations.AlterField( |
|||
model_name='vente', |
|||
name='facture', |
|||
field=models.ForeignKey(on_delete=models.CASCADE, verbose_name='Invoice', to='cotisations.BaseInvoice') |
|||
), |
|||
migrations.RemoveField( |
|||
model_name='facture', |
|||
name='id', |
|||
), |
|||
migrations.RemoveField( |
|||
model_name='facture', |
|||
name='date', |
|||
), |
|||
migrations.AlterField( |
|||
model_name='facture', |
|||
name='baseinvoice_ptr', |
|||
field=models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='cotisations.BaseInvoice'), |
|||
) |
|||
] |
|||
@ -0,0 +1,108 @@ |
|||
{% comment %} |
|||
Re2o est un logiciel d'administration développé initiallement au rezometz. Il |
|||
se veut agnostique au réseau considéré, de manière à être installable en |
|||
quelques clics. |
|||
|
|||
Copyright © 2017 Gabriel Détraz |
|||
Copyright © 2017 Goulven Kermarec |
|||
Copyright © 2017 Augustin Lemesle |
|||
Copyright © 2018 Hugo Levy-Falk |
|||
|
|||
This program is free software; you can redistribute it and/or modify |
|||
it under the terms of the GNU General Public License as published by |
|||
the Free Software Foundation; either version 2 of the License, or |
|||
(at your option) any later version. |
|||
|
|||
This program is distributed in the hope that it will be useful, |
|||
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
GNU General Public License for more details. |
|||
|
|||
You should have received a copy of the GNU General Public License along |
|||
with this program; if not, write to the Free Software Foundation, Inc., |
|||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
|||
{% endcomment %} |
|||
{% load i18n %} |
|||
{% load acl %} |
|||
|
|||
<div class="table-responsive"> |
|||
{% if custom_invoice_list.paginator %} |
|||
{% include 'pagination.html' with list=custom_invoice_list %} |
|||
{% endif %} |
|||
|
|||
<table class="table table-striped"> |
|||
<thead> |
|||
<tr> |
|||
<th> |
|||
{% trans "Recipient" as tr_recip %} |
|||
{% include 'buttons/sort.html' with prefix='invoice' col='user' text=tr_user %} |
|||
</th> |
|||
<th>{% trans "Designation" %}</th> |
|||
<th>{% trans "Total price" %}</th> |
|||
<th> |
|||
{% trans "Payment method" as tr_payment_method %} |
|||
{% include 'buttons/sort.html' with prefix='invoice' col='payement' text=tr_payment_method %} |
|||
</th> |
|||
<th> |
|||
{% trans "Date" as tr_date %} |
|||
{% include 'buttons/sort.html' with prefix='invoice' col='date' text=tr_date %} |
|||
</th> |
|||
<th> |
|||
{% trans "Invoice id" as tr_invoice_id %} |
|||
{% include 'buttons/sort.html' with prefix='invoice' col='id' text=tr_invoice_id %} |
|||
</th> |
|||
<th>{% trans "Paid" %}</th> |
|||
<th></th> |
|||
<th></th> |
|||
</tr> |
|||
</thead> |
|||
{% for invoice in custom_invoice_list %} |
|||
<tr> |
|||
<td>{{ invoice.recipient }}</td> |
|||
<td>{{ invoice.name }}</td> |
|||
<td>{{ invoice.prix_total }}</td> |
|||
<td>{{ invoice.payment }}</td> |
|||
<td>{{ invoice.date }}</td> |
|||
<td>{{ invoice.id }}</td> |
|||
<td>{{ invoice.paid }}</td> |
|||
<td> |
|||
<div class="dropdown"> |
|||
<button class="btn btn-default dropdown-toggle" type="button" id="editinvoice" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true"> |
|||
{% trans "Edit" %}<span class="caret"></span> |
|||
</button> |
|||
<ul class="dropdown-menu" aria-labelledby="editinvoice"> |
|||
{% can_edit invoice %} |
|||
<li> |
|||
<a href="{% url 'cotisations:edit-custom-invoice' invoice.id %}"> |
|||
<i class="fa fa-dollar-sign"></i> {% trans "Edit" %} |
|||
</a> |
|||
</li> |
|||
{% acl_end %} |
|||
{% can_delete invoice %} |
|||
<li> |
|||
<a href="{% url 'cotisations:del-custom-invoice' invoice.id %}"> |
|||
<i class="fa fa-trash"></i> {% trans "Delete" %} |
|||
</a> |
|||
</li> |
|||
{% acl_end %} |
|||
<li> |
|||
<a href="{% url 'cotisations:history' 'custominvoice' invoice.id %}"> |
|||
<i class="fa fa-history"></i> {% trans "Historique" %} |
|||
</a> |
|||
</li> |
|||
</ul> |
|||
</div> |
|||
</td> |
|||
<td> |
|||
<a class="btn btn-primary btn-sm" role="button" href="{% url 'cotisations:custom-invoice-pdf' invoice.id %}"> |
|||
<i class="fa fa-file-pdf"></i> {% trans "PDF" %} |
|||
</a> |
|||
</td> |
|||
</tr> |
|||
{% endfor %} |
|||
</table> |
|||
|
|||
{% if custom_invoice_list.paginator %} |
|||
{% include 'pagination.html' with list=custom_invoice_list %} |
|||
{% endif %} |
|||
</div> |
|||
@ -0,0 +1,36 @@ |
|||
{% extends "cotisations/sidebar.html" %} |
|||
{% comment %} |
|||
Re2o est un logiciel d'administration développé initiallement au rezometz. Il |
|||
se veut agnostique au réseau considéré, de manière à être installable en |
|||
quelques clics. |
|||
|
|||
Copyright © 2017 Gabriel Détraz |
|||
Copyright © 2017 Goulven Kermarec |
|||
Copyright © 2017 Augustin Lemesle |
|||
|
|||
This program is free software; you can redistribute it and/or modify |
|||
it under the terms of the GNU General Public License as published by |
|||
the Free Software Foundation; either version 2 of the License, or |
|||
(at your option) any later version. |
|||
|
|||
This program is distributed in the hope that it will be useful, |
|||
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
GNU General Public License for more details. |
|||
|
|||
You should have received a copy of the GNU General Public License along |
|||
with this program; if not, write to the Free Software Foundation, Inc., |
|||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
|||
{% endcomment %} |
|||
{% load acl %} |
|||
{% load i18n %} |
|||
|
|||
{% block title %}{% trans "Custom invoices" %}{% endblock %} |
|||
|
|||
{% block content %} |
|||
<h2>{% trans "Custom invoices list" %}</h2> |
|||
{% can_create CustomInvoice %} |
|||
{% include "buttons/add.html" with href='cotisations:new-custom-invoice'%} |
|||
{% acl_end %} |
|||
{% include 'cotisations/aff_custom_invoice.html' with custom_invoice_list=custom_invoice_list %} |
|||
{% endblock %} |
|||
Loading…
Reference in new issue