[FIX]GOLEM Activity Registration Payment : unique invoice this season

And not default season only
This commit is contained in:
Fabien BOURGEOIS 2018-10-23 18:22:04 +02:00
parent 64a1fac6c8
commit 7b9cbb4145
2 changed files with 4 additions and 3 deletions

View File

@ -20,7 +20,7 @@
'name': 'GOLEM Activity Member Registration Payments', 'name': 'GOLEM Activity Member Registration Payments',
'summary': 'GOLEM Activities Member Registration Payments', 'summary': 'GOLEM Activities Member Registration Payments',
'description': 'GOLEM Activities Member Registration Payments', 'description': 'GOLEM Activities Member Registration Payments',
'version': '10.0.0.4.1', 'version': '10.0.0.5.0',
'category': 'GOLEM', 'category': 'GOLEM',
'author': 'Fabien Bourgeois', 'author': 'Fabien Bourgeois',
'license': 'AGPL-3', 'license': 'AGPL-3',

View File

@ -1,6 +1,7 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# Copyright 2017-2018 Fabien Bourgeois <fabien@yaltik.com> # Copyright 2017-2018 Fabien Bourgeois <fabien@yaltik.com>
# Copyright 2018 Youssef El Ouahby <youssef@yaltik.com>
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as # it under the terms of the GNU Affero General Public License as
@ -86,8 +87,8 @@ class GolemActivityRegistrationInvoicing(models.TransientModel):
partner = self.member_id.partner_id partner = self.member_id.partner_id
#check if there is a draft invoice for the current customer #check if there is a draft invoice for the current customer
member_line = partner.member_lines.filtered( member_line = partner.member_lines.filtered(
lambda ml: (ml.membership_id.membership_season_id.is_default and lambda ml: (ml.membership_id.membership_season_id == self.season_id
ml.account_invoice_id.state == 'draft') and ml.account_invoice_id.state == 'draft')
) )
if member_line: if member_line:
invoice = member_line[0].account_invoice_id invoice = member_line[0].account_invoice_id