forked from Yaltik/golem
Création du module resource pack basique
This commit is contained in:
parent
6b3942389d
commit
e36c9b537c
19
golem_resource_pack/__init__.py
Normal file
19
golem_resource_pack/__init__.py
Normal file
@ -0,0 +1,19 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Copyright 2018 Youssef El Ouahby <youssef@yaltik.com>
|
||||
# Copyright 2018 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
|
31
golem_resource_pack/__manifest__.py
Normal file
31
golem_resource_pack/__manifest__.py
Normal file
@ -0,0 +1,31 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Copyright 2018 Youssef El Ouahby <youssef@yaltik.com>
|
||||
# Copyright 2018 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 resources pack',
|
||||
'summary': 'GOLEM resources pack',
|
||||
'description': ''' GOLEM resources pack ''',
|
||||
'version': '10.0.0.0.0',
|
||||
'category': 'GOLEM',
|
||||
'author': 'Youssef El Ouahby, Fabien Bourgeois',
|
||||
'license': 'AGPL-3',
|
||||
'application': True,
|
||||
'installable': True,
|
||||
'depends': ['golem_resource'],
|
||||
'data': ['views/golem_resource_pack_views.xml']
|
||||
}
|
19
golem_resource_pack/models/__init__.py
Normal file
19
golem_resource_pack/models/__init__.py
Normal file
@ -0,0 +1,19 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Copyright 2018 Youssef El Ouahby <youssef@yaltik.com>
|
||||
# Copyright 2018 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_resource_pack
|
30
golem_resource_pack/models/golem_resource_pack.py
Normal file
30
golem_resource_pack/models/golem_resource_pack.py
Normal file
@ -0,0 +1,30 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Copyright 2018 Youssef El Ouahby <youssef@yaltik.com>
|
||||
# Copyright 2018 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/>.
|
||||
|
||||
""" GOLEM Resource Packs """
|
||||
|
||||
from odoo import models, fields, api, _
|
||||
from odoo.exceptions import ValidationError
|
||||
|
||||
|
||||
class GolemResourcePack(models.Model):
|
||||
""" GOLEM Resource Pack Model """
|
||||
_name = 'golem.resource.pack'
|
||||
_description = 'GOLEM Resource Pack Model'
|
||||
|
||||
name = fields.Char()#compute='_compute_name', store=True)
|
166
golem_resource_pack/views/golem_resource_pack_views.xml
Normal file
166
golem_resource_pack/views/golem_resource_pack_views.xml
Normal file
@ -0,0 +1,166 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright 2018 Youssef El Ouahby <youssef@yaltik.com>
|
||||
Copyright 2018 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>
|
||||
|
||||
<!-- Calendars -->
|
||||
<!-- <record model="ir.ui.view" id="golem_resource_reservation_view_calendar">
|
||||
<field name="name">GOLEM Resource Reservation Calendar</field>
|
||||
<field name="model">golem.resource.reservation</field>
|
||||
<field name="arch" type="xml">
|
||||
<calendar date_start="date_start" date_stop="date_stop" color="resource_id"
|
||||
event_open_popup="%(golem_resource.golem_resource_reservation_view_form)s"
|
||||
mode="month">
|
||||
<field name="resource_id" />
|
||||
<field name="partner_id" />
|
||||
<field name="note" />
|
||||
</calendar>
|
||||
</field>
|
||||
</record>-->
|
||||
|
||||
<!-- Trees -->
|
||||
<!--<record model="ir.ui.view" id="golem_resource_reservation_view_tree">
|
||||
<field name="name">GOLEM Resource Reservation Tree</field>
|
||||
<field name="model">golem.resource.reservation</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree colors="black: state=='draft'; blue: state=='validated'; gree : state=='validated'; grey: state=='canceled'; orange: state=='rejected'">
|
||||
<field name="resource_id" />
|
||||
<field name="date_start" />
|
||||
<field name="date_stop" />
|
||||
<field name="partner_id" />
|
||||
<field name="state" />
|
||||
<field name='day_start' invisible='1'/>
|
||||
|
||||
</tree>
|
||||
</field>
|
||||
</record>-->
|
||||
|
||||
<!-- Forms -->
|
||||
<!-- <record model="ir.ui.view" id="golem_resource_reservation_view_form">
|
||||
<field name="name">GOLEM Resource Reservation Form</field>
|
||||
<field name="model">golem.resource.reservation</field>
|
||||
<field name="arch" type="xml">
|
||||
<form>
|
||||
<header>
|
||||
<button name="state_confirm" type="object" string="Confirm" class="oe_highlight"
|
||||
attrs="{'invisible': ['|', ('state', 'not in', 'draft'), ('id', '=', False)]}" />
|
||||
<button name="state_canceled" type="object"
|
||||
string="Cancel" states="confirmed,validated" />
|
||||
<button name="state_draft" type="object" string="Set to draft"
|
||||
states="canceled,confirmed,validated,rejected" />
|
||||
<button name="state_validated" type="object" string="Validate"
|
||||
states="confirmed" class="oe_highlight"
|
||||
groups="golem_base.group_golem_manager" />
|
||||
<button name="state_rejected" type="object" string="Reject"
|
||||
states="confirmed" class="oe_highlight"
|
||||
groups="golem_base.group_golem_manager" />
|
||||
<field name="state" widget="statusbar" />
|
||||
</header>
|
||||
<sheet>
|
||||
<group>
|
||||
<group name="resource" string="Resource">
|
||||
<field name="id" invisible="1" />
|
||||
<field name="resource_id" options="{'no_create': True}" />
|
||||
<field name="resource_avaibility_24_7" readonly="1" />
|
||||
<field name="resource_avaibility_start" readonly="1" />
|
||||
<field name="resource_avaibility_stop" readonly="1" />
|
||||
<field name="resource_timetable_ids" readonly="1"
|
||||
attrs="{'invisible': [('resource_avaibility_24_7', '=', True)]}" />
|
||||
</group>
|
||||
<group name="reservation" string="Reservation">
|
||||
<group>
|
||||
<field name="date_start" />
|
||||
<field name="date_stop" />
|
||||
<field name="user_id" options="{'no_create': True}" />
|
||||
<field name="partner_id" />
|
||||
<field name="note"
|
||||
placeholder="Notes, optional subject for the reservation, reason" />
|
||||
<field name="rejection_reason"
|
||||
attrs="{'invisible': [('state', '!=', 'rejected')]}"/>
|
||||
</group>
|
||||
</group>
|
||||
</group>
|
||||
</sheet>
|
||||
<div class="oe_chatter">
|
||||
<field name="message_follower_ids" widget="mail_followers" />
|
||||
<field name="message_ids" widget="mail_thread" />
|
||||
</div>
|
||||
</form>
|
||||
</field>
|
||||
</record>-->
|
||||
|
||||
<!-- Searches -->
|
||||
<!--<record model="ir.ui.view" id="golem_resource_reservation_view_search">
|
||||
<field name="name">GOLEM Resource Reservation Search</field>
|
||||
<field name="model">golem.resource.reservation</field>
|
||||
<field name="arch" type="xml">
|
||||
<search>
|
||||
<field name="date_start" />
|
||||
<field name="date_stop" />
|
||||
<field name="day_start"/>
|
||||
<field name="resource_id" />
|
||||
<field name="user_id" />
|
||||
<field name="partner_id" />
|
||||
<field name="state" />
|
||||
<filter name="state_draft" string="Draft"
|
||||
domain="[('state', '=', 'draft')]" />
|
||||
<filter name="state_confirmed" string="Confirmed, to Validate"
|
||||
domain="[('state', '=', 'confirmed')]" />
|
||||
<filter name="state_validated" string="Validated"
|
||||
domain="[('state', '=', 'validated')]" />
|
||||
<filter name="state_rejected" string="Rejected"
|
||||
domain="[('state', '=', 'rejected')]" />
|
||||
<separator />
|
||||
<filter name="day_reservation" string="Day Reservation"
|
||||
domain="[('day_start', '=', context_today().strftime('%%Y-%%m-%%d'))]" />
|
||||
<filter name="7days_reservation" string="7 Days Reservations"
|
||||
domain="[('date_start', '>=', (context_today()+datetime.timedelta(days=0)).strftime('%%Y-%%m-%%d')),
|
||||
('date_start', '<=', (context_today()+datetime.timedelta(days=7)).strftime('%%Y-%%m-%%d'))]" />
|
||||
<filter name="30days_reservation" string="30 Days Reservations"
|
||||
domain="[('date_start', '>=', (context_today()+datetime.timedelta(days=0)).strftime('%%Y-%%m-%%d')),
|
||||
('date_start', '<=', (context_today()+datetime.timedelta(days=30)).strftime('%%Y-%%m-%%d'))]" />
|
||||
<filter name="group_state" string="State"
|
||||
context="{'group_by': 'state'}" />
|
||||
<filter name="group_resource" string="Resource"
|
||||
context="{'group_by': 'resource_id'}" />
|
||||
<filter name="group_partner_id" string="Partner"
|
||||
context="{'group_by': 'partner_id'}" />
|
||||
<filter name="group_user" string="User"
|
||||
context="{'group_by': 'user_id'}" />
|
||||
<filter name="group_date_month" string="Month"
|
||||
context="{'group_by': 'date:month'}" />
|
||||
<filter name="group_date_week" string="Week"
|
||||
context="{'group_by': 'date:week'}" />
|
||||
<filter name="group_date_day" string="Day"
|
||||
context="{'group_by': 'date:day'}" />
|
||||
</search>
|
||||
</field>
|
||||
</record>-->
|
||||
|
||||
<!-- Actions -->
|
||||
<act_window id="golem_resource_pack_action" name="Reservation Pack"
|
||||
res_model="golem.resource.pack" view_mode="tree,form,calendar" />
|
||||
|
||||
<!-- Menus -->
|
||||
<menuitem id="golem_resource_packs_menu" name="Reservation Packs"
|
||||
parent="golem_resource.golem_resource_menu" action="golem_resource_pack_action"
|
||||
sequence="20" />
|
||||
|
||||
</data>
|
||||
</odoo>
|
Loading…
Reference in New Issue
Block a user