diff --git a/golem_ressources/__init__.py b/golem_ressources/__init__.py index 1fced20..f95e908 100644 --- a/golem_ressources/__init__.py +++ b/golem_ressources/__init__.py @@ -16,4 +16,4 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . -from . import models +from . import models, wizard diff --git a/golem_ressources/__manifest__.py b/golem_ressources/__manifest__.py index f1a91f3..7874a49 100644 --- a/golem_ressources/__manifest__.py +++ b/golem_ressources/__manifest__.py @@ -20,7 +20,7 @@ 'name': 'GOLEM non-profit resources', 'summary': 'GOLEM resources management', 'description': ''' GOLEM resources management ''', - 'version': '10.0.1.0.3', + 'version': '10.0.1.0.4', 'category': 'GOLEM', 'author': 'Youssef El Ouahby, Fabien Bourgeois', 'license': 'AGPL-3', @@ -29,5 +29,6 @@ 'depends': ['product'], 'data': ['views/golem_resources_views.xml', 'views/golem_reservation_views.xml', + 'wizard/golem_reservation_rejection_views.xml', 'security/ir.model.access.csv'] } diff --git a/golem_ressources/models/golem_resources.py b/golem_ressources/models/golem_resources.py index 89acf7b..11e38fe 100644 --- a/golem_ressources/models/golem_resources.py +++ b/golem_ressources/models/golem_resources.py @@ -20,21 +20,6 @@ from odoo import models, fields, api, _, exceptions -class GolemResourceRejectionWizard(models.TransientModel): - """GOLEM Resource wizard : refusal reason for a reservation """ - _name = "golem.resource.rejection.wizard" - - reservation_id = fields.Many2one('golem.reservation', required=True) - reason = fields.Text(required=True) - - @api.multi - def validate(self, vals): - """ Sets reservation status to rejected and add reason """ - self.ensure_one() - rejection = self[0] - rejection.reservation_id.write({'status': 'rejected', - 'rejection_reason': rejection.reason}) - #modèle de base : ressources class GolemResources(models.Model): @@ -108,7 +93,7 @@ class GolemReservation(models.Model): reservation_id = self[0] return {'name' : _('Please enter the rejection reason'), 'type' : 'ir.actions.act_window', - 'res_model' : 'golem.resource.rejection.wizard', + 'res_model' : 'golem.reservation.rejection.wizard', 'context': {'default_reservation_id': reservation_id.id}, 'view_mode': 'form', 'target': 'new'} diff --git a/golem_ressources/views/golem_reservation_views.xml b/golem_ressources/views/golem_reservation_views.xml index 8ece16c..14e0af2 100644 --- a/golem_ressources/views/golem_reservation_views.xml +++ b/golem_ressources/views/golem_reservation_views.xml @@ -112,23 +112,5 @@ along with this program. If not, see . - - GOLEM Resource Rejection Wizard Form - golem.resource.rejection.wizard - -
- - - - -
-
-
-
-
- diff --git a/golem_ressources/wizard/__init__.py b/golem_ressources/wizard/__init__.py new file mode 100644 index 0000000..9a0c408 --- /dev/null +++ b/golem_ressources/wizard/__init__.py @@ -0,0 +1,19 @@ +# -*- coding: utf-8 -*- + +# Copyright 2018 Youssef El Ouahby +# Copyright 2018 Fabien Bourgeois +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . + +from . import golem_reservation_rejection diff --git a/golem_ressources/wizard/golem_reservation_rejection.py b/golem_ressources/wizard/golem_reservation_rejection.py new file mode 100644 index 0000000..01484ab --- /dev/null +++ b/golem_ressources/wizard/golem_reservation_rejection.py @@ -0,0 +1,36 @@ +# -*- coding: utf-8 -*- + +# Copyright 2018 Youssef El Ouahby +# Copyright 2018 Fabien Bourgeois +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . + +""" GOLEM Resources management """ + +from odoo import models, fields, api + +class GolemReservationRejectionWizard(models.TransientModel): + """GOLEM Resource wizard : refusal reason for a reservation """ + _name = "golem.reservation.rejection.wizard" + + reservation_id = fields.Many2one('golem.reservation', required=True) + reason = fields.Text(required=True) + + @api.multi + def validate(self): + """ Sets reservation status to rejected and add reason """ + self.ensure_one() + rejection = self[0] + rejection.reservation_id.write({'status': 'rejected', + 'rejection_reason': rejection.reason}) diff --git a/golem_ressources/wizard/golem_reservation_rejection_views.xml b/golem_ressources/wizard/golem_reservation_rejection_views.xml new file mode 100644 index 0000000..97f2e83 --- /dev/null +++ b/golem_ressources/wizard/golem_reservation_rejection_views.xml @@ -0,0 +1,42 @@ + + + + + + + + GOLEM Reservation Rejection Wizard Form + golem.reservation.rejection.wizard + +
+ + + + + +
+
+
+ +
+