forked from Yaltik/golem
first version of golem ressource, models : resources and reservation
This commit is contained in:
parent
503d482c25
commit
d814343758
18
golem_ressources/__init__.py
Normal file
18
golem_ressources/__init__.py
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
# Copyright 2016 Fabien Bourgeois <fabien@yaltik.com>
|
||||||
|
#
|
||||||
|
# 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 <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
from . import models
|
33
golem_ressources/__manifest__.py
Normal file
33
golem_ressources/__manifest__.py
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
# Copyright 2016 Fabien Bourgeois <fabien@yaltik.com>
|
||||||
|
#
|
||||||
|
# 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 <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
{
|
||||||
|
'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',
|
||||||
|
]
|
||||||
|
}
|
18
golem_ressources/models/__init__.py
Normal file
18
golem_ressources/models/__init__.py
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
# Copyright 2016 Fabien Bourgeois <fabien@yaltik.com>
|
||||||
|
#
|
||||||
|
# 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 <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
from . import golem_resources
|
77
golem_ressources/models/golem_resources.py
Normal file
77
golem_ressources/models/golem_resources.py
Normal file
@ -0,0 +1,77 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
# Copyright 2017 Fabien Bourgeois <fabien@yaltik.com>
|
||||||
|
#
|
||||||
|
# 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 <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
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')
|
3
golem_ressources/security/ir.model.access.csv
Normal file
3
golem_ressources/security/ir.model.access.csv
Normal file
@ -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
|
|
80
golem_ressources/views/golem_reservation_views.xml
Normal file
80
golem_ressources/views/golem_reservation_views.xml
Normal file
@ -0,0 +1,80 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!--
|
||||||
|
Copyright 2017 Fabien Bourgeois <fabien@yaltik.com>
|
||||||
|
|
||||||
|
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 <http://www.gnu.org/licenses/>.
|
||||||
|
-->
|
||||||
|
<odoo>
|
||||||
|
<data>
|
||||||
|
<record model="ir.ui.view" id="reservation_calendar_view">
|
||||||
|
<field name="name">reservation.calendar</field>
|
||||||
|
<field name="model">golem.reservation</field>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<calendar string="Reservation Calendar" date_start="start_date" date_stop="end_date"
|
||||||
|
color="linked_resource">
|
||||||
|
<field name="linked_resource"/>
|
||||||
|
<field name="user"/>
|
||||||
|
<field name="on_behalf_of"/>
|
||||||
|
</calendar>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
<record model="ir.ui.view" id="reservation_tree_view">
|
||||||
|
<field name="name">reservation.tree</field>
|
||||||
|
<field name="model">golem.reservation</field>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<tree string="Reservation tree">
|
||||||
|
<field name="start_date"/>
|
||||||
|
<field name="end_date"/>
|
||||||
|
<field name="linked_resource"/>
|
||||||
|
<field name="user"/>
|
||||||
|
<field name="on_behalf_of"/>
|
||||||
|
<field name="status" widget="statusbar"/>
|
||||||
|
</tree>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
<record model="ir.ui.view" id="reservation_form_view">
|
||||||
|
<field name="name">reservation.form</field>
|
||||||
|
<field name="model">golem.reservation</field>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<form string="Reservation Form">
|
||||||
|
<header>
|
||||||
|
<button name="status_confirm" type="object"
|
||||||
|
string="Confirm" statuss="draft"
|
||||||
|
class="oe_highlight"/>
|
||||||
|
<button name="status_canceled" type="object"
|
||||||
|
string="Cancel" statuss="confirmed"
|
||||||
|
class="oe_highlight"/>
|
||||||
|
<field name="status" widget="statusbar"/>
|
||||||
|
</header>
|
||||||
|
<sheet>
|
||||||
|
<group>
|
||||||
|
<field name="start_date"/>
|
||||||
|
<field name="end_date"/>
|
||||||
|
<field name="linked_resource"/>
|
||||||
|
<field name="user"/>
|
||||||
|
<field name="on_behalf_of"/>
|
||||||
|
</group>
|
||||||
|
</sheet>
|
||||||
|
</form>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
<record model="ir.actions.act_window" id="action_reservation">
|
||||||
|
<field name="name">Reservation</field>
|
||||||
|
<field name="res_model">golem.reservation</field>
|
||||||
|
<field name="view_mode">tree,form,calendar</field>
|
||||||
|
</record>
|
||||||
|
<menuitem id="reservation_sub_menu" name="Reservation" parent="resources_menu"
|
||||||
|
action="action_reservation"/>
|
||||||
|
</data>
|
||||||
|
</odoo>
|
102
golem_ressources/views/golem_resources_views.xml
Normal file
102
golem_ressources/views/golem_resources_views.xml
Normal file
@ -0,0 +1,102 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!--
|
||||||
|
Copyright 2017 Fabien Bourgeois <fabien@yaltik.com>
|
||||||
|
|
||||||
|
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 <http://www.gnu.org/licenses/>.
|
||||||
|
-->
|
||||||
|
<odoo>
|
||||||
|
<data>
|
||||||
|
<record model="golem.weekday" id="1">
|
||||||
|
<field name="name">Sunday</field>
|
||||||
|
</record>
|
||||||
|
<record model="golem.weekday" id="2">
|
||||||
|
<field name="name">Monday</field>
|
||||||
|
</record>
|
||||||
|
<record model="golem.weekday" id="3">
|
||||||
|
<field name="name">Tuesday</field>
|
||||||
|
</record>
|
||||||
|
<record model="golem.weekday" id="4">
|
||||||
|
<field name="name">wednesday</field>
|
||||||
|
</record>
|
||||||
|
<record model="golem.weekday" id="5">
|
||||||
|
<field name="name">Thursday</field>
|
||||||
|
</record>
|
||||||
|
<record model="golem.weekday" id="6">
|
||||||
|
<field name="name">Friday</field>
|
||||||
|
</record>
|
||||||
|
<record model="golem.weekday" id="7">
|
||||||
|
<field name="name">Saturday</field>
|
||||||
|
</record>
|
||||||
|
<record model="ir.ui.view" id="resource_search_view">
|
||||||
|
<field name="name">resource.search</field>
|
||||||
|
<field name="model">golem.resources</field>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<search string="Resource Search">
|
||||||
|
<field name="name"/>
|
||||||
|
<field name="resource_type"/>
|
||||||
|
<field name="resource_responsible"/>
|
||||||
|
<field name="article_link"/>
|
||||||
|
</search>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
<record model="ir.ui.view" id="resource_tree_view">
|
||||||
|
<field name="name">resource.tree</field>
|
||||||
|
<field name="model">golem.resources</field>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<tree string="Resource Form">
|
||||||
|
<field name="name"/>
|
||||||
|
<field name="resource_type"/>
|
||||||
|
<field name="resource_responsible"/>
|
||||||
|
<field name="article_link"/>
|
||||||
|
<field name="start_of_availability_date"/>
|
||||||
|
<field name="end_of_availability_date"/>
|
||||||
|
<field name="weekdays_of_availibility" widget="many2many_tags" options="{'no_create_edit':'1'}"/>
|
||||||
|
</tree>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
<record model="ir.ui.view" id="resource_form_view">
|
||||||
|
<field name="name">resource.form</field>
|
||||||
|
<field name="model">golem.resources</field>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<form string="Resource Form">
|
||||||
|
<sheet>
|
||||||
|
<group colspan="2">
|
||||||
|
<group colspan="4" col="4">
|
||||||
|
<field name="name"/>
|
||||||
|
<field name="resource_type"/>
|
||||||
|
<field name="resource_responsible"/>
|
||||||
|
<field name="article_link"/>
|
||||||
|
</group>
|
||||||
|
<group colspan="3">
|
||||||
|
<separator string="Availibility configuration" colspan="3"/>
|
||||||
|
<field name="start_of_availability_date"/>
|
||||||
|
<field name="end_of_availability_date"/>
|
||||||
|
<field name="weekdays_of_availibility" widget="many2many_tags" options="{'no_create_edit':'1'}"/>
|
||||||
|
</group>
|
||||||
|
</group>
|
||||||
|
</sheet>
|
||||||
|
</form>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="ir.actions.act_window" id="action_resources">
|
||||||
|
<field name="name">Resources</field>
|
||||||
|
<field name="res_model">golem.resources</field>
|
||||||
|
<field name="view_mode">tree,form,search</field>
|
||||||
|
</record>
|
||||||
|
<menuitem id="resources_menu" name="Resources" sequence="10"/>
|
||||||
|
<menuitem id="resources_sub_menu" name="Resources" parent="resources_menu"
|
||||||
|
action="action_resources"/>
|
||||||
|
</data>
|
||||||
|
</odoo>
|
Loading…
Reference in New Issue
Block a user