Prevent free activity from being invoiced

This commit is contained in:
Youssef Elouahby 2018-09-19 16:54:35 +01:00
parent 0c3a62cac8
commit cbfccd5515

View File

@ -36,7 +36,8 @@ class GolemMember(models.Model):
regis = regis.filtered(
lambda r: (r.state == 'confirmed' and
(not r.invoice_line_id or
r.invoice_line_id.invoice_id.state == 'cancel'))
r.invoice_line_id.invoice_id.state == 'cancel') and
not r.activity_id.free_activity)
)
member.has_invoicable_registrations = bool(len(regis))
@ -54,7 +55,8 @@ class GolemMember(models.Model):
registrations = member.activity_registration_ids.filtered(
lambda r: r.state == 'confirmed' and
(not r.invoice_line_id or
r.invoice_line_id.invoice_id.state == 'cancel')
r.invoice_line_id.invoice_id.state == 'cancel') and
not r.activity_id.free_activity
)
if registrations:
invoicing = self.env['golem.activity.registration.invoicing'].create({