8
0
Fork 0
mirror of https://gitlab2.federez.net/re2o/re2o synced 2024-11-22 03:13:12 +00:00

Choix de l'envoi du reçu par mail

This commit is contained in:
Hugo LEVY-FALK 2019-01-20 19:08:11 +01:00
parent f43b985966
commit 985a2f4a52
4 changed files with 33 additions and 1 deletions

View file

@ -46,6 +46,7 @@ from django.urls import reverse
from django.shortcuts import redirect from django.shortcuts import redirect
from django.contrib import messages from django.contrib import messages
from preferences.models import CotisationsOption
from machines.models import regen from machines.models import regen
from re2o.field_permissions import FieldPermissionModelMixin from re2o.field_permissions import FieldPermissionModelMixin
from re2o.mixins import AclMixin, RevMixin from re2o.mixins import AclMixin, RevMixin
@ -255,7 +256,10 @@ class Facture(BaseInvoice):
super(Facture, self).save(*args, **kwargs) super(Facture, self).save(*args, **kwargs)
if not self.__original_valid and self.valid: if not self.__original_valid and self.valid:
send_mail_invoice(self) send_mail_invoice(self)
if self.is_subscription() and not self.__original_control and self.control: if self.is_subscription() \
and not self.__original_control \
and self.control \
and CotisationsOption.get_cached_value('send_voucher_mail'):
send_mail_voucher(self) send_mail_voucher(self)
def __str__(self): def __str__(self):

View file

@ -0,0 +1,20 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.10.7 on 2019-01-20 18:03
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('preferences', '0060_assooption_pres_name'),
]
operations = [
migrations.AddField(
model_name='cotisationsoption',
name='send_voucher_mail',
field=models.BooleanField(default=False, verbose_name='Send voucher by email when the invoice is controlled.'),
),
]

View file

@ -729,3 +729,7 @@ class CotisationsOption(AclMixin, PreferencesModel):
on_delete=models.PROTECT, on_delete=models.PROTECT,
default=default_voucher, default=default_voucher,
) )
send_voucher_mail = models.BooleanField(
verbose_name=_("Send voucher by email when the invoice is controlled."),
default=False,
)

View file

@ -361,6 +361,10 @@ with this program; if not, write to the Free Software Foundation, Inc.,
<i class="fa fa-edit"></i> <i class="fa fa-edit"></i>
</a> </a>
<table class="table table-striped"> <table class="table table-striped">
<tr>
<th>{% trans "Send voucher by email" %}</th>
<td>{{ cotisationsoptions.send_voucher_mail | tick }}</th>
</tr>
<tr> <tr>
<th>{% trans "Invoices' template" %}</th> <th>{% trans "Invoices' template" %}</th>
<td>{{ cotisationsoptions.invoice_template }}</td> <td>{{ cotisationsoptions.invoice_template }}</td>