From 3050e554b91f7aade3f8b19a46a457533c15fb27 Mon Sep 17 00:00:00 2001 From: Fabien BOURGEOIS Date: Tue, 27 Mar 2018 11:32:42 +0200 Subject: [PATCH] [IMP][FIX]GOLEM Resource Account : should not group reservations on a single invoice if parters are not the same (thanks Youssef) --- golem_resource_account/__manifest__.py | 2 +- golem_resource_account/models/golem_resource_reservation.py | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/golem_resource_account/__manifest__.py b/golem_resource_account/__manifest__.py index b6b0cf7..fb647c3 100644 --- a/golem_resource_account/__manifest__.py +++ b/golem_resource_account/__manifest__.py @@ -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', diff --git a/golem_resource_account/models/golem_resource_reservation.py b/golem_resource_account/models/golem_resource_reservation.py index 51b8727..a18ad91 100644 --- a/golem_resource_account/models/golem_resource_reservation.py +++ b/golem_resource_account/models/golem_resource_reservation.py @@ -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(