Commit 985a2f4a authored by Hugo LEVY-FALK's avatar Hugo LEVY-FALK

Choix de l'envoi du reçu par mail

parent f43b9859
...@@ -46,6 +46,7 @@ from django.urls import reverse ...@@ -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): ...@@ -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):
......
# -*- 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.'),
),
]
...@@ -729,3 +729,7 @@ class CotisationsOption(AclMixin, PreferencesModel): ...@@ -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,
)
...@@ -361,6 +361,10 @@ with this program; if not, write to the Free Software Foundation, Inc., ...@@ -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>
......
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