mirror of https://gitlab.federez.net/re2o/re2o
10 changed files with 366 additions and 19 deletions
@ -0,0 +1,50 @@ |
|||
# -*- coding: utf-8 -*- |
|||
# Generated by Django 1.10.7 on 2019-01-03 16:48 |
|||
from __future__ import unicode_literals |
|||
import os |
|||
|
|||
from django.db import migrations, models |
|||
from django.core.files import File |
|||
from django.conf import settings |
|||
import re2o.mixins |
|||
|
|||
|
|||
def create_default_templates(apps, schema_editor): |
|||
DocumentTemplate = apps.get_model('cotisations', 'DocumentTemplate') |
|||
invoice_path = os.path.join( |
|||
settings.BASE_DIR, |
|||
"cotisations", |
|||
"templates", |
|||
"cotisations", |
|||
"factures.tex" |
|||
) |
|||
with open(invoice_path) as f: |
|||
tpl, _ = DocumentTemplate.objects.get_or_create( |
|||
name="Re2o default invoice", |
|||
) |
|||
tpl.template.save('default_invoice.tex', File(f)) |
|||
tpl.save() |
|||
|
|||
|
|||
class Migration(migrations.Migration): |
|||
|
|||
dependencies = [ |
|||
('cotisations', '0038_auto_20181231_1657'), |
|||
] |
|||
|
|||
operations = [ |
|||
migrations.CreateModel( |
|||
name='DocumentTemplate', |
|||
fields=[ |
|||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), |
|||
('template', models.FileField(upload_to='templates/', verbose_name='template')), |
|||
('name', models.CharField(max_length=255, verbose_name='name')), |
|||
], |
|||
options={ |
|||
'verbose_name_plural': 'document templates', |
|||
'verbose_name': 'document template', |
|||
}, |
|||
bases=(re2o.mixins.RevMixin, re2o.mixins.AclMixin, models.Model), |
|||
), |
|||
migrations.RunPython(create_default_templates), |
|||
] |
|||
@ -0,0 +1,50 @@ |
|||
{% 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 %} |
|||
{% load logs_extra %} |
|||
|
|||
<table class="table table-striped"> |
|||
<thead> |
|||
<tr> |
|||
<th>{% trans "Document template" %}</th> |
|||
<th>{% trans "File" %}</th> |
|||
<th></th> |
|||
</tr> |
|||
</thead> |
|||
{% for template in document_template_list %} |
|||
<tr> |
|||
<td>{{ template.name }}</td> |
|||
<td><a href="{{template.template.url}}">{{template.template}}</a></td> |
|||
<td class="text-right"> |
|||
{% can_edit template %} |
|||
{% include 'buttons/edit.html' with href='cotisations:edit-document-template' id=template.id %} |
|||
{% acl_end %} |
|||
{% history_button template %} |
|||
</td> |
|||
</tr> |
|||
{% endfor %} |
|||
</table> |
|||
|
|||
@ -0,0 +1,42 @@ |
|||
{% 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 © 2019 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 bootstrap3 %} |
|||
{% load acl %} |
|||
{% load i18n %} |
|||
|
|||
{% block title %}{% trans "Document Templates" %}{% endblock %} |
|||
|
|||
{% block content %} |
|||
<h2>{% trans "Document templates list" %}</h2> |
|||
{% can_create Banque %} |
|||
<a class="btn btn-primary btn-sm" role="button" href="{% url 'cotisations:add-document-template' %}"> |
|||
<i class="fa fa-cart-plus"></i> {% trans "Add a document template" %} |
|||
</a> |
|||
{% acl_end %} |
|||
<a class="btn btn-danger btn-sm" role="button" href="{% url 'cotisations:del-document-template' %}"> |
|||
<i class="fa fa-trash"></i> {% trans "Delete one or several document templates" %} |
|||
</a> |
|||
{% include 'cotisations/aff_document_template.html' %} |
|||
{% endblock %} |
|||
|
|||
Loading…
Reference in new issue