Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
R
re2o
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Nounous
re2o
Commits
2dd410fe
Commit
2dd410fe
authored
Aug 31, 2018
by
Gabriel Detraz
Committed by
detraz
Sep 01, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix l'envoie de mail, en postsave maintenant (plus propre)
parent
cd8a23da
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
34 additions
and
16 deletions
+34
-16
cotisations/migrations/0034_auto_20180831_1532.py
cotisations/migrations/0034_auto_20180831_1532.py
+20
-0
cotisations/models.py
cotisations/models.py
+13
-5
cotisations/payment_methods/balance/models.py
cotisations/payment_methods/balance/models.py
+0
-2
cotisations/payment_methods/cheque/models.py
cotisations/payment_methods/cheque/models.py
+0
-2
cotisations/payment_methods/comnpay/models.py
cotisations/payment_methods/comnpay/models.py
+0
-2
cotisations/views.py
cotisations/views.py
+1
-5
No files found.
cotisations/migrations/0034_auto_20180831_1532.py
0 → 100644
View file @
2dd410fe
# -*- coding: utf-8 -*-
# Generated by Django 1.10.7 on 2018-08-31 13:32
from
__future__
import
unicode_literals
from
django.db
import
migrations
,
models
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'cotisations'
,
'0033_auto_20180818_1319'
),
]
operations
=
[
migrations
.
AlterField
(
model_name
=
'facture'
,
name
=
'valid'
,
field
=
models
.
BooleanField
(
default
=
False
,
verbose_name
=
'validated'
),
),
]
cotisations/models.py
View file @
2dd410fe
...
...
@@ -50,7 +50,7 @@ from machines.models import regen
from
re2o.field_permissions
import
FieldPermissionModelMixin
from
re2o.mixins
import
AclMixin
,
RevMixin
from
cotisations.utils
import
find_payment_method
from
cotisations.utils
import
find_payment_method
,
send_mail_invoice
from
cotisations.validators
import
check_no_balance
...
...
@@ -137,7 +137,7 @@ class Facture(BaseInvoice):
)
# TODO : change name to validity for clarity
valid
=
models
.
BooleanField
(
default
=
Tru
e
,
default
=
Fals
e
,
verbose_name
=
_
(
"validated"
)
)
# TODO : changed name to controlled for clarity
...
...
@@ -231,6 +231,7 @@ class Facture(BaseInvoice):
self
.
field_permissions
=
{
'control'
:
self
.
can_change_control
,
}
self
.
__original_valid
=
self
.
valid
def
__str__
(
self
):
return
str
(
self
.
user
)
+
' '
+
str
(
self
.
date
)
...
...
@@ -242,9 +243,12 @@ def facture_post_save(**kwargs):
Synchronise the LDAP user after an invoice has been saved.
"""
facture
=
kwargs
[
'instance'
]
user
=
facture
.
user
user
.
set_active
()
user
.
ldap_sync
(
base
=
True
,
access_refresh
=
True
,
mac_refresh
=
False
)
if
facture
.
valid
:
user
=
facture
.
user
if
not
facture
.
__original_valid
:
user
.
set_active
()
send_mail_invoice
(
facture
)
user
.
ldap_sync
(
base
=
False
,
access_refresh
=
True
,
mac_refresh
=
False
)
@
receiver
(
post_delete
,
sender
=
Facture
)
...
...
@@ -702,6 +706,10 @@ class Paiement(RevMixin, AclMixin, models.Model):
if
payment_method
is
not
None
and
use_payment_method
:
return
payment_method
.
end_payment
(
invoice
,
request
)
## So make this invoice valid, trigger send mail
invoice
.
valid
=
True
invoice
.
save
()
# In case a cotisation was bought, inform the user, the
# cotisation time has been extended too
if
any
(
sell
.
type_cotisation
for
sell
in
invoice
.
vente_set
.
all
()):
...
...
cotisations/payment_methods/balance/models.py
View file @
2dd410fe
...
...
@@ -74,8 +74,6 @@ class BalancePayment(PaymentMethodMixin, models.Model):
user
=
invoice
.
user
total_price
=
invoice
.
prix_total
()
if
float
(
user
.
solde
)
-
float
(
total_price
)
<
self
.
minimum_balance
:
invoice
.
valid
=
False
invoice
.
save
()
messages
.
error
(
request
,
_
(
"Your balance is too low for this operation."
)
...
...
cotisations/payment_methods/cheque/models.py
View file @
2dd410fe
...
...
@@ -46,8 +46,6 @@ class ChequePayment(PaymentMethodMixin, models.Model):
"""Invalidates the invoice then redirect the user towards a view asking
for informations to add to the invoice before validating it.
"""
invoice
.
valid
=
False
invoice
.
save
()
return
redirect
(
reverse
(
'cotisations:cheque:validate'
,
kwargs
=
{
'invoice_pk'
:
invoice
.
pk
}
...
...
cotisations/payment_methods/comnpay/models.py
View file @
2dd410fe
...
...
@@ -81,8 +81,6 @@ class ComnpayPayment(PaymentMethodMixin, models.Model):
a facture id, the price and the secret transaction data stored in
the preferences.
"""
invoice
.
valid
=
False
invoice
.
save
()
host
=
request
.
get_host
()
p
=
Transaction
(
str
(
self
.
payment_credential
),
...
...
cotisations/views.py
View file @
2dd410fe
...
...
@@ -81,7 +81,7 @@ from .forms import (
)
from
.tex
import
render_invoice
from
.payment_methods.forms
import
payment_method_factory
from
.utils
import
find_payment_method
,
send_mail_invoice
from
.utils
import
find_payment_method
@
login_required
...
...
@@ -148,8 +148,6 @@ def new_facture(request, user, userid):
p
.
facture
=
new_invoice_instance
p
.
save
()
send_mail_invoice
(
new_invoice_instance
)
return
new_invoice_instance
.
paiement
.
end_payment
(
new_invoice_instance
,
request
...
...
@@ -848,8 +846,6 @@ def credit_solde(request, user, **_kwargs):
number
=
1
)
send_mail_invoice
(
invoice
)
return
invoice
.
paiement
.
end_payment
(
invoice
,
request
)
p
=
get_object_or_404
(
Paiement
,
is_balance
=
True
)
return
form
({
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment