Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Nounous
re2o
Commits
31ba9a27
Commit
31ba9a27
authored
Jan 21, 2019
by
Hugo LEVY-FALK
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix get_subscription of invoice.
parent
bc758a6b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
5 deletions
+8
-5
cotisations/models.py
cotisations/models.py
+8
-5
No files found.
cotisations/models.py
View file @
31ba9a27
...
...
@@ -242,14 +242,16 @@ class Facture(BaseInvoice):
self
.
__original_control
=
self
.
control
def
get_subscription
(
self
):
"""Returns every subscription associated with this invoice."""
return
Cotisation
.
objects
.
filter
(
vente__in
=
self
.
vente_set
.
filter
(
Q
(
type_cotisation
=
'All'
)
|
Q
(
type_cotisation
=
'
Cotisat
ion'
)
Q
(
type_cotisation
=
'
Adhes
ion'
)
)
)
def
is_subscription
(
self
):
"""Returns True if this invoice contains at least one subscribtion."""
return
bool
(
self
.
get_subscription
())
def
save
(
self
,
*
args
,
**
kwargs
):
...
...
@@ -257,14 +259,15 @@ class Facture(BaseInvoice):
if
not
self
.
__original_valid
and
self
.
valid
:
send_mail_invoice
(
self
)
if
self
.
is_subscription
()
\
and
not
self
.
__original_control
\
and
self
.
control
\
and
CotisationsOption
.
get_cached_value
(
'send_voucher_mail'
):
and
not
self
.
__original_control
\
and
self
.
control
\
and
CotisationsOption
.
get_cached_value
(
'send_voucher_mail'
):
send_mail_voucher
(
self
)
def
__str__
(
self
):
return
str
(
self
.
user
)
+
' '
+
str
(
self
.
date
)
@
receiver
(
post_save
,
sender
=
Facture
)
def
facture_post_save
(
**
kwargs
):
"""
...
...
@@ -795,7 +798,7 @@ 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
# So make this invoice valid, trigger send mail
invoice
.
valid
=
True
invoice
.
save
()
...
...
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