[IMP][FIX]GOLEM Resource Account : should not group reservations on a single invoice if parters are not the same (thanks Youssef)

This commit is contained in:
Fabien BOURGEOIS 2018-03-27 11:32:42 +02:00
parent 66601c03b9
commit 3050e554b9
2 changed files with 5 additions and 1 deletions

View File

@ -20,7 +20,7 @@
'name': 'GOLEM resources invoicing',
'summary': 'GOLEM resources invoicing',
'description': ''' GOLEM resources invoicing ''',
'version': '10.0.0.1.2',
'version': '10.0.0.1.3',
'category': 'GOLEM',
'author': 'Youssef El Ouahby, Fabien Bourgeois',
'license': 'AGPL-3',

View File

@ -39,6 +39,10 @@ class GolemResourceReservation(models.Model):
@api.multi
def check_before_invoicing(self):
""" Checks data coherence before invoicing """
if len(self.mapped('partner_id')) > 1:
raise ValidationError(_('You can\'t group reservations of multiple '
'clients in the same invoice, please remove '
'inadequate reservations'))
for reservation in self:
if reservation.state != "validated":
raise ValidationError(