mettre à jours resource
This commit is contained in:
parent
b8f477ffc4
commit
2353ffeeeb
@ -31,8 +31,6 @@
|
|||||||
'views/golem_resource_type_views.xml',
|
'views/golem_resource_type_views.xml',
|
||||||
'views/golem_resource_reservation_views.xml',
|
'views/golem_resource_reservation_views.xml',
|
||||||
'views/golem_resource_timetable_views.xml',
|
'views/golem_resource_timetable_views.xml',
|
||||||
'views/golem_resource_option_views.xml',
|
|
||||||
'views/golem_resource_option_selection_views.xml',
|
|
||||||
'wizard/golem_reservation_rejection_views.xml',
|
'wizard/golem_reservation_rejection_views.xml',
|
||||||
'security/ir.model.access.csv']
|
'security/ir.model.access.csv']
|
||||||
}
|
}
|
||||||
|
@ -19,6 +19,4 @@
|
|||||||
from . import golem_resource_type, \
|
from . import golem_resource_type, \
|
||||||
golem_resource_timetable, \
|
golem_resource_timetable, \
|
||||||
golem_resource, \
|
golem_resource, \
|
||||||
golem_resource_reservation, \
|
golem_resource_reservation
|
||||||
golem_resource_option, \
|
|
||||||
golem_resource_option_selection
|
|
||||||
|
@ -50,8 +50,6 @@ class GolemResource(models.Model):
|
|||||||
reservation_ids = fields.One2many('golem.resource.reservation', 'resource_id',
|
reservation_ids = fields.One2many('golem.resource.reservation', 'resource_id',
|
||||||
string='Reservations')
|
string='Reservations')
|
||||||
reservation_count = fields.Integer(compute='_compute_reservation_count')
|
reservation_count = fields.Integer(compute='_compute_reservation_count')
|
||||||
option_ids = fields.One2many('golem.resource.option', 'resource_id',
|
|
||||||
string='Option list')
|
|
||||||
|
|
||||||
@api.depends('reservation_ids')
|
@api.depends('reservation_ids')
|
||||||
def _compute_reservation_count(self):
|
def _compute_reservation_count(self):
|
||||||
|
@ -1,31 +0,0 @@
|
|||||||
# -*- 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 Option """
|
|
||||||
|
|
||||||
|
|
||||||
from odoo import models, fields
|
|
||||||
|
|
||||||
|
|
||||||
class GolemResourceOption(models.Model):
|
|
||||||
""" GOLEM Resource Option Model """
|
|
||||||
_name = 'golem.resource.option'
|
|
||||||
_description = 'GOLEM Reservation Option Model'
|
|
||||||
|
|
||||||
name = fields.Char("Option")
|
|
||||||
resource_id = fields.Many2one('golem.resource', "Resource")
|
|
@ -1,43 +0,0 @@
|
|||||||
# -*- 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 Option Selection"""
|
|
||||||
|
|
||||||
|
|
||||||
from odoo import models, fields, api, _
|
|
||||||
|
|
||||||
|
|
||||||
class GolemResourceOptionSelection(models.Model):
|
|
||||||
""" GOLEM Resource Option SelectionModel """
|
|
||||||
_name = 'golem.resource.option.selection'
|
|
||||||
_description = 'GOLEM Resource option selection Model'
|
|
||||||
|
|
||||||
name = fields.Char(compute="_compute_name")
|
|
||||||
option_id = fields.Many2one('golem.resource.option', 'Option',
|
|
||||||
domain="[('resource_id', '=', resource_id)]")
|
|
||||||
resource_id = fields.Many2one(related="reservation_id.resource_id")
|
|
||||||
reservation_id = fields.Many2one('golem.resource.reservation', 'Reservation')
|
|
||||||
|
|
||||||
@api.multi
|
|
||||||
def _compute_name(self):
|
|
||||||
for selection in self:
|
|
||||||
selection.name = "{}/{}".format(selection.resource_id.name, selection.option_id.name)
|
|
||||||
|
|
||||||
_sql_constraints = [
|
|
||||||
('unique_selection', "UNIQUE(resource_id, option_id, reservation_id)",
|
|
||||||
_("Not allowed, a reservation with same option and resource already exists"))]
|
|
@ -66,9 +66,6 @@ class GolemResourceReservation(models.Model):
|
|||||||
default='draft', track_visibility='onchange')
|
default='draft', track_visibility='onchange')
|
||||||
|
|
||||||
rejection_reason = fields.Text(readonly=True, track_visibility='onchange')
|
rejection_reason = fields.Text(readonly=True, track_visibility='onchange')
|
||||||
resource_option_ids = fields.One2many(related="resource_id.option_ids")
|
|
||||||
selected_option_ids = fields.One2many('golem.resource.option.selection', 'reservation_id',
|
|
||||||
string="Selected option")
|
|
||||||
|
|
||||||
@api.depends('resource_id', 'date_start')
|
@api.depends('resource_id', 'date_start')
|
||||||
def _compute_name(self):
|
def _compute_name(self):
|
||||||
|
@ -1,38 +0,0 @@
|
|||||||
<?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>
|
|
||||||
|
|
||||||
<!-- Form -->
|
|
||||||
<record model="ir.ui.view" id="golem_resource_option_selection_form">
|
|
||||||
<field name="name">GOLEM Resource Option Selection Form</field>
|
|
||||||
<field name="model">golem.resource.option.selection</field>
|
|
||||||
<field name="arch" type="xml">
|
|
||||||
<form >
|
|
||||||
<group>
|
|
||||||
<field name="name" invisible="1"/>
|
|
||||||
<field name="resource_id" invisible="1" />
|
|
||||||
<field name="reservation_id" invisible="1"/>
|
|
||||||
<field name="option_id"/>
|
|
||||||
</group>
|
|
||||||
</form>
|
|
||||||
</field>
|
|
||||||
</record>
|
|
||||||
</data>
|
|
||||||
</odoo>
|
|
@ -1,36 +0,0 @@
|
|||||||
<?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>
|
|
||||||
|
|
||||||
<!-- Form -->
|
|
||||||
<record model="ir.ui.view" id="golem_resource_option_form">
|
|
||||||
<field name="name">GOLEM Resource Option Form</field>
|
|
||||||
<field name="model">golem.resource.option</field>
|
|
||||||
<field name="arch" type="xml">
|
|
||||||
<form >
|
|
||||||
<group>
|
|
||||||
<field name="name" />
|
|
||||||
<field name="resource_id" invisible="1" />
|
|
||||||
</group>
|
|
||||||
</form>
|
|
||||||
</field>
|
|
||||||
</record>
|
|
||||||
</data>
|
|
||||||
</odoo>
|
|
@ -77,7 +77,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
<group name="resource" string="Resource">
|
<group name="resource" string="Resource">
|
||||||
<field name="id" invisible="1" />
|
<field name="id" invisible="1" />
|
||||||
<field name="resource_id" options="{'no_create': True}" />
|
<field name="resource_id" options="{'no_create': True}" />
|
||||||
<field name="resource_option_ids" widget="many2many_tags" readonly="1"/>
|
|
||||||
<field name="resource_avaibility_24_7" readonly="1" />
|
<field name="resource_avaibility_24_7" readonly="1" />
|
||||||
<field name="resource_avaibility_start" readonly="1" />
|
<field name="resource_avaibility_start" readonly="1" />
|
||||||
<field name="resource_avaibility_stop" readonly="1" />
|
<field name="resource_avaibility_stop" readonly="1" />
|
||||||
@ -94,13 +93,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
placeholder="Notes, optional subject for the reservation, reason" />
|
placeholder="Notes, optional subject for the reservation, reason" />
|
||||||
<field name="rejection_reason"
|
<field name="rejection_reason"
|
||||||
attrs="{'invisible': [('state', '!=', 'rejected')]}"/>
|
attrs="{'invisible': [('state', '!=', 'rejected')]}"/>
|
||||||
<field name="selected_option_ids"
|
|
||||||
context="{'default_reservation_id': active_id}"
|
|
||||||
widget="many2many_tags">
|
|
||||||
<tree>
|
|
||||||
<field name="option_id"/>
|
|
||||||
</tree>
|
|
||||||
</field>
|
|
||||||
</group>
|
</group>
|
||||||
</group>
|
</group>
|
||||||
</group>
|
</group>
|
||||||
|
@ -62,12 +62,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
<field name="name" />
|
<field name="name" />
|
||||||
<field name="type_id" />
|
<field name="type_id" />
|
||||||
<field name="product_tmpl_id" options="{'no_create': True}" />
|
<field name="product_tmpl_id" options="{'no_create': True}" />
|
||||||
<field name="supervisor_id" />
|
|
||||||
<field name="validation_required" />
|
|
||||||
</group>
|
</group>
|
||||||
<group>
|
<group>
|
||||||
<field name="option_ids" widget="many2many_tags"
|
<field name="validation_required" />
|
||||||
context="{'default_resource_id': active_id}" />
|
<field name="supervisor_id" />
|
||||||
</group>
|
</group>
|
||||||
</group>
|
</group>
|
||||||
<group string="Availibility configuration">
|
<group string="Availibility configuration">
|
||||||
|
Loading…
x
Reference in New Issue
Block a user