diff --git a/golem_ressources/__init__.py b/golem_ressources/__init__.py new file mode 100644 index 0000000..2fca3d2 --- /dev/null +++ b/golem_ressources/__init__.py @@ -0,0 +1,18 @@ +# -*- coding: utf-8 -*- + +# Copyright 2016 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 models diff --git a/golem_ressources/__manifest__.py b/golem_ressources/__manifest__.py new file mode 100644 index 0000000..0ba9576 --- /dev/null +++ b/golem_ressources/__manifest__.py @@ -0,0 +1,33 @@ +# -*- coding: utf-8 -*- + +# Copyright 2016 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 . + +{ + 'name': 'GOLEM non-profit resources', + 'summary': 'Extends Odoo resources for MJC', + 'version': '10.0.1.0.0', + 'category': 'GOLEM', + 'author': 'Youssef El ouahby', + 'license': 'AGPL-3', + 'application': True, + 'installable': True, + 'depends': ['golem_base', 'golem_activity', 'golem_season', + 'odoo_partner_merge'], + 'data': ['views/golem_resources_views.xml', + 'views/golem_reservation_views.xml', + 'security/ir.model.access.csv', + ] +} diff --git a/golem_ressources/models/__init__.py b/golem_ressources/models/__init__.py new file mode 100644 index 0000000..43371e7 --- /dev/null +++ b/golem_ressources/models/__init__.py @@ -0,0 +1,18 @@ +# -*- coding: utf-8 -*- + +# Copyright 2016 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_resources diff --git a/golem_ressources/models/golem_resources.py b/golem_ressources/models/golem_resources.py new file mode 100644 index 0000000..d0a37b4 --- /dev/null +++ b/golem_ressources/models/golem_resources.py @@ -0,0 +1,77 @@ +# -*- coding: utf-8 -*- + +# Copyright 2017 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 odoo import models, fields, api + +class GolemResources(models.Model): + """ GOLEM Resources """ + _name = 'golem.resources' + _description = 'GOLEM Resources' + + name = fields.Char() + resource_type = fields.Many2one("golem.resourcetype", string="Resource type") + resource_responsible = fields.Many2one("res.partner", string="Resource Responsible") + article_link = fields.Many2one("product.template", string="Article Link") + #Configuration de disponibilité + start_of_availability_date = fields.Date(string="Start of availibility date ") + end_of_availability_date = fields.Date(string="End of availibility date ") + weekdays_of_availibility = fields.Many2many('golem.weekday', string="Weekdays of availibility") + + +class GolemReservation(models.Model): + """ GOLEM Reservation """ + _name = 'golem.reservation' + _description = 'GOLEM Reservation' + + start_date = fields.Datetime(string='Start date') + end_date = fields.Datetime(string='End date') + linked_resource = fields.Many2one('golem.resources', string="Linked resource") + user = fields.Many2one('res.users', required=True) + on_behalf_of = fields.Many2one('res.partner', required=True) + status = fields.Selection([ + ('draft', "Draft"), + ('confirmed', "Confirmed"), + ('canceled', "Canceled"), + ], default='draft') + + @api.multi + def status_draft(self): + self.status = 'draft' + + @api.multi + def status_confirm(self): + self.status = 'confirmed' + + @api.multi + def status_canceled(self): + self.status = 'canceled' + +class GolemResourceType(models.Model): + """ GOLEM Resource Type """ + _name = 'golem.resourcetype' + _description = 'GOLEM Resource Type' + + name = fields.Char(string='Resource Type') + +class GolemWeekDays(models.Model): + """ GOLEM Week Days """ + _name = 'golem.weekday' + _description = 'GOLEM Week Day' + + name = fields.Char(string='Week Day') diff --git a/golem_ressources/security/ir.model.access.csv b/golem_ressources/security/ir.model.access.csv new file mode 100644 index 0000000..a269e71 --- /dev/null +++ b/golem_ressources/security/ir.model.access.csv @@ -0,0 +1,3 @@ +id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink +access_golem_resources_user,Access GOLEM Resources User,model_golem_resources,golem_base.group_golem_user,1,0,0,0 +access_golem_resources_manager,Access GOLEM Resources Manager,model_golem_resources,golem_base.group_golem_manager,1,1,1,1 diff --git a/golem_ressources/views/golem_reservation_views.xml b/golem_ressources/views/golem_reservation_views.xml new file mode 100644 index 0000000..12883e5 --- /dev/null +++ b/golem_ressources/views/golem_reservation_views.xml @@ -0,0 +1,80 @@ + + + + + + reservation.calendar + golem.reservation + + + + + + + + + + reservation.tree + golem.reservation + + + + + + + + + + + + + reservation.form + golem.reservation + +
+
+
+ + + + + + + + + +
+
+
+ + Reservation + golem.reservation + tree,form,calendar + + +
+
diff --git a/golem_ressources/views/golem_resources_views.xml b/golem_ressources/views/golem_resources_views.xml new file mode 100644 index 0000000..6008b34 --- /dev/null +++ b/golem_ressources/views/golem_resources_views.xml @@ -0,0 +1,102 @@ + + + + + + Sunday + + + Monday + + + Tuesday + + + wednesday + + + Thursday + + + Friday + + + Saturday + + + resource.search + golem.resources + + + + + + + + + + + resource.tree + golem.resources + + + + + + + + + + + + + + resource.form + golem.resources + +
+ + + + + + + + + + + + + + + + +
+
+
+ + + Resources + golem.resources + tree,form,search + + + +
+