From eccc2178828ddf662b7e177ebe598f043c267b61 Mon Sep 17 00:00:00 2001 From: eloyoussef Date: Tue, 13 Feb 2018 15:04:55 +0100 Subject: [PATCH] =?UTF-8?q?Ajout=20des=20boutons=20de=20validation=20et=20?= =?UTF-8?q?du=20filtre=20sur=20la=20liste=20des=20r=C3=A9s=C3=A9rvation?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- golem_ressources/models/golem_resources.py | 10 +++++ .../views/golem_reservation_views.xml | 37 ++++++++++++++++--- .../views/golem_resources_views.xml | 2 + 3 files changed, 44 insertions(+), 5 deletions(-) diff --git a/golem_ressources/models/golem_resources.py b/golem_ressources/models/golem_resources.py index 8d00a7f..77a5351 100644 --- a/golem_ressources/models/golem_resources.py +++ b/golem_ressources/models/golem_resources.py @@ -77,6 +77,14 @@ class GolemReservation(models.Model): def status_canceled(self): self.status = 'canceled' + @api.multi + def status_validated(self): + self.status = 'validated' + + @api.multi + def status_rejected(self): + self.status = 'rejected' + @api.constrains('status') def _onConfirmReservation(self): if self.status == 'confirmed': @@ -106,6 +114,8 @@ class GolemReservation(models.Model): for reservation in self.linked_resource.reservation : if(self.id != reservation.id and reservation.status == 'confirmed' and not (self.end_date < reservation.start_date or self.start_date > reservation.end_date)): raise exceptions.UserError("Not allowed, the resource is taken during this period, please choose another période before confirming ") + elif (not self.linked_resource.validation_required): + self.status = 'validated' diff --git a/golem_ressources/views/golem_reservation_views.xml b/golem_ressources/views/golem_reservation_views.xml index bd38ff0..fbee2cf 100644 --- a/golem_ressources/views/golem_reservation_views.xml +++ b/golem_ressources/views/golem_reservation_views.xml @@ -43,6 +43,7 @@ along with this program. If not, see . + @@ -55,11 +56,17 @@ along with this program. If not, see .
@@ -74,10 +81,30 @@ along with this program. If not, see .
+ + + + reservation.search + golem.reservation + + + + + + + + + + + + + + Reservation golem.reservation - tree,form,calendar + tree,search,form,calendar diff --git a/golem_ressources/views/golem_resources_views.xml b/golem_ressources/views/golem_resources_views.xml index 48057d1..2f69a75 100644 --- a/golem_ressources/views/golem_resources_views.xml +++ b/golem_ressources/views/golem_resources_views.xml @@ -70,6 +70,7 @@ along with this program. If not, see . + @@ -95,6 +96,7 @@ along with this program. If not, see . +