diff --git a/golem_resource_pack/__manifest__.py b/golem_resource_pack/__manifest__.py
index df0fe6c..25d251c 100644
--- a/golem_resource_pack/__manifest__.py
+++ b/golem_resource_pack/__manifest__.py
@@ -20,7 +20,7 @@
'name': 'GOLEM resources pack',
'summary': 'GOLEM resources pack',
'description': ''' GOLEM resources pack ''',
- 'version': '10.0.0.0.5',
+ 'version': '10.0.0.0.6',
'category': 'GOLEM',
'author': 'Youssef El Ouahby, Fabien Bourgeois',
'license': 'AGPL-3',
@@ -29,5 +29,6 @@
'depends': ['golem_resource'],
'data': ['views/golem_resource_pack_views.xml',
'wizard/golem_pack_rejection_views.xml',
+ 'wizard/golem_pack_quick_reservation_views.xml',
'security/ir.model.access.csv']
}
diff --git a/golem_resource_pack/models/golem_resource_pack.py b/golem_resource_pack/models/golem_resource_pack.py
index 5fba353..f997ac4 100644
--- a/golem_resource_pack/models/golem_resource_pack.py
+++ b/golem_resource_pack/models/golem_resource_pack.py
@@ -52,6 +52,18 @@ class GolemResourcePack(models.Model):
reservation_count = fields.Integer(compute='_compute_reservation_count')
rejection_reason = fields.Text(readonly=True, track_visibility='onchange')
+ @api.multi
+ def quick_reservation(self):
+ """ Quick Reservation Creating"""
+ self.ensure_one()
+ pack_id = self[0]
+ return {'name' : _('Reservations Creating'),
+ 'type' : 'ir.actions.act_window',
+ 'res_model' : 'golem.pack.quick.reservation.wizard',
+ 'context': {'default_pack_id': pack_id.id},
+ 'view_mode': 'form',
+ 'target': 'new'}
+
@api.depends('reservation_ids')
def _compute_reservation_count(self):
for pack in self:
diff --git a/golem_resource_pack/views/golem_resource_pack_views.xml b/golem_resource_pack/views/golem_resource_pack_views.xml
index 096a3fb..b3a38e6 100644
--- a/golem_resource_pack/views/golem_resource_pack_views.xml
+++ b/golem_resource_pack/views/golem_resource_pack_views.xml
@@ -61,8 +61,15 @@ along with this program. If not, see .
+
+
+
+
+
.
-from . import golem_pack_rejection
+from . import golem_pack_rejection, golem_pack_quick_reservation
diff --git a/golem_resource_pack/wizard/golem_pack_quick_reservation.py b/golem_resource_pack/wizard/golem_pack_quick_reservation.py
new file mode 100644
index 0000000..e3e581f
--- /dev/null
+++ b/golem_resource_pack/wizard/golem_pack_quick_reservation.py
@@ -0,0 +1,43 @@
+# -*- 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 Pack Quick Reservation Wizard """
+
+from odoo import models, fields, api
+
+class GolemPackQuickReservationWizard(models.TransientModel):
+ """GOLEM Pack Quick Reservation Wizard """
+ _name = "golem.pack.quick.reservation.wizard"
+
+ pack_id = fields.Many2one('golem.resource.pack', required=True)
+ resource_ids = fields.Many2many('golem.resource', string="Resource List")
+
+ date_start = fields.Datetime('Start date', required=True)
+ date_stop = fields.Datetime('Stop date', required=True)
+
+
+ @api.multi
+ def create_reservations(self):
+ """ Create a reservation for each resource """
+ pass
+ """
+ self.ensure_one()
+ rdata = {'state': 'rejected',
+ 'rejection_reason': self[0].reason}
+ self[0].pack_id.reservation_ids.filtered(lambda r: r.state == 'confirmed').write(rdata)
+ self[0].pack_id.rejection_reason = self[0].reason"""
diff --git a/golem_resource_pack/wizard/golem_pack_quick_reservation_views.xml b/golem_resource_pack/wizard/golem_pack_quick_reservation_views.xml
new file mode 100644
index 0000000..a164245
--- /dev/null
+++ b/golem_resource_pack/wizard/golem_pack_quick_reservation_views.xml
@@ -0,0 +1,45 @@
+
+
+
+
+
+
+
+ GOLEM Pack Quick Reservation Wizard Form
+ golem.pack.quick.reservation.wizard
+
+
+
+
+
+