forked from Yaltik/golem
[REF]GOLEM Resources : huge code refactoring, renamings etc.
This commit is contained in:
parent
2b70d2c1b0
commit
fe0d57dffc
@ -20,7 +20,7 @@
|
||||
'name': 'GOLEM non-profit resources',
|
||||
'summary': 'GOLEM resources management',
|
||||
'description': ''' GOLEM resources management ''',
|
||||
'version': '10.0.1.0.4',
|
||||
'version': '10.0.1.1.0',
|
||||
'category': 'GOLEM',
|
||||
'author': 'Youssef El Ouahby, Fabien Bourgeois',
|
||||
'license': 'AGPL-3',
|
||||
|
@ -18,73 +18,120 @@
|
||||
|
||||
""" GOLEM Resources management """
|
||||
|
||||
from odoo import models, fields, api, _, exceptions
|
||||
from math import modf
|
||||
from odoo import models, fields, api, _
|
||||
from odoo.exceptions import UserError, ValidationError
|
||||
|
||||
|
||||
#modèle de base : ressources
|
||||
class GolemResources(models.Model):
|
||||
""" GOLEM Resources """
|
||||
_name = 'golem.resources'
|
||||
_description = 'GOLEM Resources'
|
||||
class GolemResource(models.Model):
|
||||
""" GOLEM Resource Model """
|
||||
_name = 'golem.resource'
|
||||
_description = 'GOLEM Resource Model'
|
||||
|
||||
name = fields.Char(required=True)
|
||||
name = fields.Char(required=True, index=True)
|
||||
active = fields.Boolean(default=True)
|
||||
validation_required = fields.Boolean(default=True)
|
||||
resource_type = fields.Many2one("golem.resourcetype")
|
||||
resource_responsible = fields.Many2one("res.partner")
|
||||
article_link = fields.Many2one("product.template")
|
||||
validation_required = fields.Boolean(default=True,
|
||||
string='Is validation required ?')
|
||||
type_id = fields.Many2one('golem.resource.type',
|
||||
index=True, string='Resource Type')
|
||||
supervisor_id = fields.Many2one('res.partner', index=True, string='Supervisor')
|
||||
product_tmpl_id = fields.Many2one('product.template', index=True,
|
||||
string='Linked product')
|
||||
|
||||
#Configuration de disponibilité(période, jours et horaire)
|
||||
start_of_availability_date = fields.Date(required=True)
|
||||
end_of_availability_date = fields.Date(required=True)
|
||||
timetable = fields.One2many("golem.timetable", "resource_id", string="Availibility timetable")
|
||||
reservation = fields.One2many("golem.reservation", "linked_resource")
|
||||
avaibility_start = fields.Date(required=True, string='Availibility start date')
|
||||
avaibility_stop = fields.Date(required=True, string='Availibility stop date')
|
||||
timetable_ids = fields.One2many('golem.resource.timetable', 'resource_id',
|
||||
string='Availibility timetable')
|
||||
reservation_ids = fields.One2many('golem.resource.reservation', 'resource_id',
|
||||
string='Reservations')
|
||||
|
||||
@api.multi
|
||||
def active_change(self):
|
||||
self.active = not self.active
|
||||
def active_toggle(self):
|
||||
""" Toggles active boolean """
|
||||
for resource in self:
|
||||
resource.active = not resource.active
|
||||
|
||||
|
||||
class GolemResourceReservation(models.Model):
|
||||
""" GOLEM Resource Reservation Model """
|
||||
_name = 'golem.resource.reservation'
|
||||
_description = 'GOLEM Reservation Model'
|
||||
|
||||
#modèle gestion des reservation
|
||||
class GolemReservation(models.Model):
|
||||
""" GOLEM Reservation """
|
||||
_name = 'golem.reservation'
|
||||
_description = 'GOLEM Reservation'
|
||||
name = fields.Char(compute='_compute_name', store=True)
|
||||
# TODO: handle multiple days reservation
|
||||
date = fields.Date(required=True, index=True)
|
||||
hour_start = fields.Float('Start hour', required=True)
|
||||
hour_stop = fields.Float('Stop hour', required=True)
|
||||
date_start = fields.Datetime(compute='_compute_date_start', store=True, index=True)
|
||||
date_stop = fields.Datetime(compute='_compute_date_stop', store=True, index=True)
|
||||
|
||||
start_date = fields.Datetime()
|
||||
end_date = fields.Datetime()
|
||||
linked_resource = fields.Many2one('golem.resources', required=True)
|
||||
user = fields.Many2one('res.users', required=True, default=lambda self: self.env.user)
|
||||
on_behalf_of = fields.Many2one('res.partner', required=True, default=lambda self: self.env['res.partner'])
|
||||
rejection_reason = fields.Text()
|
||||
resource_id = fields.Many2one('golem.resource', required=True, index=True,
|
||||
string='Resource')
|
||||
user_id = fields.Many2one('res.users', required=True, index=True,
|
||||
string='User',
|
||||
default=lambda self: self.env.user)
|
||||
partner_id = fields.Many2one('res.partner', string='On behalf of',
|
||||
required=True, index=True)
|
||||
status = fields.Selection([
|
||||
('draft', "Draft"),
|
||||
('confirmed', "Confirmed"),
|
||||
('canceled', "Canceled"),
|
||||
('validated', "Validated"),
|
||||
('rejected', "Rejected"),
|
||||
('draft', 'Draft'),
|
||||
('confirmed', 'Confirmed'),
|
||||
('canceled', 'Canceled'),
|
||||
('validated', 'Validated'),
|
||||
('rejected', 'Rejected'),
|
||||
], default='draft')
|
||||
|
||||
rejection_reason = fields.Text()
|
||||
|
||||
@api.depends('resource_id', 'date')
|
||||
def _compute_name(self):
|
||||
""" Computes reservation name """
|
||||
for reservation in self:
|
||||
reservation.name = u'{}/{}'.format(reservation.resource_id.name,
|
||||
reservation.date)
|
||||
|
||||
@api.depends('date', 'hour_start')
|
||||
def _compute_date_start(self):
|
||||
""" Computes Date start """
|
||||
for reservation in self:
|
||||
hour_start, minute_start = modf(reservation.hour_start)
|
||||
minute_start = int(round(minute_start * 60))
|
||||
reservation.date_start = u'{} {}:{}'.format(reservation.date,
|
||||
hour_start, minute_start)
|
||||
|
||||
@api.depends('date', 'hour_stop')
|
||||
def _compute_date_stop(self):
|
||||
""" Computes Date stop """
|
||||
for reservation in self:
|
||||
hour_stop, minute_stop = modf(reservation.hour_stop)
|
||||
minute_stop = int(round(minute_stop * 60))
|
||||
reservation.date_stop = u'{} {}:{}'.format(reservation.date,
|
||||
hour_stop, minute_stop)
|
||||
|
||||
@api.multi
|
||||
def status_draft(self):
|
||||
self.status = 'draft'
|
||||
""" Status to draft """
|
||||
self.write({'status': 'draft'})
|
||||
|
||||
@api.multi
|
||||
def status_confirm(self):
|
||||
self.status = 'confirmed'
|
||||
if( not self.linked_resource.validation_required) :
|
||||
self.status='validated'
|
||||
""" Confirms reservation, or validates it if not workflow is involved """
|
||||
for reservation in self:
|
||||
if reservation.resource_id.validation_required:
|
||||
reservation.status = 'confirmed'
|
||||
else:
|
||||
reservation.status_validated()
|
||||
|
||||
|
||||
@api.multi
|
||||
def status_canceled(self):
|
||||
self.status = 'canceled'
|
||||
""" Status to cancel """
|
||||
self.write({'status': 'canceled'})
|
||||
|
||||
@api.multi
|
||||
def status_validated(self):
|
||||
self.status = 'validated'
|
||||
|
||||
""" Status to validated """
|
||||
self.write({'status': 'validated'})
|
||||
|
||||
@api.multi
|
||||
def status_rejected(self):
|
||||
@ -100,68 +147,84 @@ class GolemReservation(models.Model):
|
||||
|
||||
|
||||
@api.constrains('status')
|
||||
def _onConfirmReservation(self):
|
||||
if self.status == 'confirmed':
|
||||
#verifyin is the reservation is taking place out of the resource availibility period
|
||||
if(self.start_date < self.linked_resource.start_of_availability_date or self.end_date > self.linked_resource.end_of_availability_date ):
|
||||
raise exceptions.UserError('Not allowed, the resource is not available in this period, please choose another périod before confirming %s' % self.linked_resource.start_of_availability_date)
|
||||
else :
|
||||
#verifying if the reservation is taking place out the availibility timetable
|
||||
#defining a boolean flag, which will determine if the day of the reservation is available
|
||||
r_allowed = False
|
||||
for day in self.linked_resource.timetable :
|
||||
#if the day is available, look for the time if it's inside the resource timetable availibility
|
||||
if day.name.id_day == fields.Datetime.from_string(self.start_date).weekday():
|
||||
start_hour = fields.Datetime.from_string(self.start_date).hour
|
||||
start_min = float(fields.Datetime.from_string(self.start_date).minute) #+(int(fields.Datetime.from_string(self.start_date).min))/100
|
||||
start_time_r = start_hour + start_min/100
|
||||
start_hour = fields.Datetime.from_string(self.end_date).hour
|
||||
start_min = float(fields.Datetime.from_string(self.end_date).minute) #+(int(fields.Datetime.from_string(self.start_date).min))/100
|
||||
end_time_r = start_hour + start_min/100
|
||||
#if the time is suitable, the flag state is changed
|
||||
if(start_time_r > day.start_time and end_time_r < day.end_time):
|
||||
r_allowed = True
|
||||
#if the flag is changed no erreur is raised.
|
||||
if(not r_allowed):
|
||||
raise exceptions.UserError("Not allowed, the resource is not available during this timetable, please choose another time before confirming ")
|
||||
#verifying if the resource is already taken during this period
|
||||
for reservation in self.linked_resource.reservation :
|
||||
if(self.id != reservation.id and reservation.status == 'confirmed' and not (self.end_date < reservation.start_date or self.start_date > reservation.end_date)):
|
||||
raise exceptions.UserError("Not allowed, the resource is taken during this period, please choose another période before confirming ")
|
||||
elif (not self.linked_resource.validation_required):
|
||||
self.status = 'validated'
|
||||
def check_confirmed(self):
|
||||
""" Check date coherence on reservation confirmation """
|
||||
for reservation in self:
|
||||
if reservation.status == 'confirmed':
|
||||
# Check is reservation is not taking place out of the resource avaibility period
|
||||
if reservation.date < reservation.resource_id.avaibility_start or \
|
||||
reservation.date > reservation.resource_id.avaibility_stop:
|
||||
uerr = _('Not allowed, the resource is not available in '
|
||||
'this period, please choose another périod before '
|
||||
'confirming')
|
||||
raise UserError(uerr)
|
||||
# Check if reservation is not taking place out the avaibility timetables
|
||||
is_day_allowed = False
|
||||
for timetable in reservation.resource_id.timetable_ids:
|
||||
# Check for the time according to resource timetable avaibility
|
||||
date = fields.Datetime.from_string(reservation.date)
|
||||
if int(timetable.weekday) == date.weekday():
|
||||
is_day_allowed = True
|
||||
if reservation.hour_start < timetable.date_start or \
|
||||
reservation.hour_stop > timetable.date_stop:
|
||||
uerr = _('Not allowed, the resource is not available '
|
||||
'during this period, please choose another '
|
||||
'time before confirming.')
|
||||
raise UserError(uerr)
|
||||
if not is_day_allowed:
|
||||
uerr = _('Not allowed, the resource is not available '
|
||||
'this day. Please choose another date.')
|
||||
raise UserError(uerr)
|
||||
# Check if the resource is already taken during this period
|
||||
# PERF : check the date, not iterate over all reservations
|
||||
domain = [('resource_id', '=', reservation.resource_id.id),
|
||||
('date', '=', reservation.date),
|
||||
('status', '=', 'confirmed'),
|
||||
('id', '!=', reservation.id)]
|
||||
reservations = self.env['golem.resource.reservation'].search(domain)
|
||||
for other_res in reservations:
|
||||
if (other_res.hour_start < reservation.hour_start < other_res.hour_stop) or \
|
||||
(other_res.hour_start < reservation.hour_stop < other_res.hour_stop):
|
||||
uerr = _('Not allowed, the resource is already taken '
|
||||
'during this period : from {} to {} this day, '
|
||||
'please choose another périod before confirming.')
|
||||
raise UserError(uerr.format(reservation.date_start,
|
||||
reservation.date_stop))
|
||||
# Finally, validate the reservation if all checks have passed
|
||||
if reservation.resource_id.validation_required:
|
||||
reservation.status = 'validated'
|
||||
|
||||
|
||||
|
||||
#modèle de base pour identifier le type de la ressource
|
||||
class GolemResourceType(models.Model):
|
||||
""" GOLEM Resource Type """
|
||||
_name = 'golem.resourcetype'
|
||||
_name = 'golem.resource.type'
|
||||
_description = 'GOLEM Resource Type'
|
||||
_sql_constraints = [('golem_resource_type_name_uniq',
|
||||
'UNIQUE (name)',
|
||||
'Resource type must be unique.')]
|
||||
|
||||
name = fields.Char(string='Resource Type',required=True)
|
||||
name = fields.Char(string='Resource Type', required=True, index=True)
|
||||
|
||||
#modèle de base pour stocker les jours de la semaine
|
||||
class GolemWeekDay(models.Model):
|
||||
""" GOLEM Week Day """
|
||||
_name = 'golem.weekday'
|
||||
_description = 'GOLEM Week Day'
|
||||
|
||||
name = fields.Char(string='Week Day')
|
||||
id_day = fields.Integer()
|
||||
|
||||
#modèle de gestion horaire
|
||||
class GolemTimetable(models.Model):
|
||||
""" Golem Timetable """
|
||||
_name = "golem.timetable"
|
||||
_name = "golem.resource.timetable"
|
||||
_description = "Golem Timetable"
|
||||
_rec_name = 'weekday'
|
||||
|
||||
resource_id = fields.Many2one("golem.resources", required=True)
|
||||
name = fields.Many2one("golem.weekday", required=True)
|
||||
start_time = fields.Float(required=True)
|
||||
end_time = fields.Float(required=True)
|
||||
resource_id = fields.Many2one('golem.resource', required=True,
|
||||
string='Linked resource')
|
||||
weekday = fields.Selection([('0', _('Monday')),
|
||||
('1', _('Tuesday')),
|
||||
('2', _('Wednesday')),
|
||||
('3', _('Thursday')),
|
||||
('4', _('Friday')),
|
||||
('5', _('Saturday')),
|
||||
('6', _('Sunday'))], copy=False)
|
||||
time_start = fields.Float(required=True, string='Start')
|
||||
time_stop = fields.Float(required=True, string='Stop')
|
||||
|
||||
@api.constrains('start_time', 'end_time')
|
||||
@api.constrains('time_start', 'time_stop')
|
||||
def _check_time_consistency(self):
|
||||
if self.end_time < self.start_time:
|
||||
raise exceptions.ValidationError(_('End time should be higher than start time'))
|
||||
for timetable in self:
|
||||
if timetable.time_stop < timetable.time_start:
|
||||
raise ValidationError(_('End time should be after than start time'))
|
||||
|
@ -1,3 +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
|
||||
access_golem_resource_user,Access GOLEM Resources User,model_golem_resource,golem_base.group_golem_user,1,0,0,0
|
||||
access_golem_resource_manager,Access GOLEM Resources Manager,model_golem_resource,golem_base.group_golem_manager,1,1,1,1
|
|
@ -18,99 +18,96 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
-->
|
||||
<odoo>
|
||||
<data>
|
||||
<!--Calendrier des reservations-->
|
||||
<record model="ir.ui.view" id="reservation_calendar_view">
|
||||
<field name="name">reservation.calendar</field>
|
||||
<field name="model">golem.reservation</field>
|
||||
|
||||
<!-- 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 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 date_start="date_start" date_stop="date_stop" color="resource_id">
|
||||
<field name="resource_id" />
|
||||
<field name="user_id" />
|
||||
<field name="partner_id" />
|
||||
</calendar>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!--liste des réservations -->
|
||||
<record model="ir.ui.view" id="reservation_tree_view">
|
||||
<field name="name">reservation.tree</field>
|
||||
<field name="model">golem.reservation</field>
|
||||
<!-- 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 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"/>
|
||||
|
||||
<tree>
|
||||
<field name="date_start" />
|
||||
<field name="date_stop" />
|
||||
<field name="resource_id" />
|
||||
<field name="user_id" />
|
||||
<field name="partner_id" />
|
||||
<field name="status" />
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!--Formulaire de réservation de ressource-->
|
||||
<record model="ir.ui.view" id="reservation_form_view">
|
||||
<field name="name">reservation.form</field>
|
||||
<field name="model">golem.reservation</field>
|
||||
<!-- 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 string="Reservation Form">
|
||||
<form>
|
||||
<header>
|
||||
<button name="status_confirm" type="object"
|
||||
string="Confirm" statuss="draft"
|
||||
class="oe_highlight"/>
|
||||
string="Confirm" status="draft"
|
||||
class="oe_highlight" />
|
||||
<button name="status_canceled" type="object"
|
||||
string="Cancel" statuss="confirmed"
|
||||
class="oe_highlight"/>
|
||||
string="Cancel" status="confirmed" />
|
||||
<button name="status_validated" type="object"
|
||||
string="Validate" statuss="confirmed"
|
||||
class="oe_highlight"/>
|
||||
string="Validate" status="confirmed"
|
||||
class="oe_highlight" />
|
||||
<button name="status_rejected" type="object"
|
||||
string="Reject" statuss="confirmed"
|
||||
class="oe_highlight"/>
|
||||
<field name="status" widget="statusbar"/>
|
||||
|
||||
string="Reject" status="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"/>
|
||||
<field name="rejection_reason"/>
|
||||
<field name="date_start" />
|
||||
<field name="date_stop" />
|
||||
<field name="resource_id" />
|
||||
<field name="user_id" />
|
||||
<field name="partner_id" />
|
||||
<field name="rejection_reason" />
|
||||
</group>
|
||||
</sheet>
|
||||
</sheet>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- recherche relative au menu reservation-->
|
||||
<record model="ir.ui.view" id="reservation_search_view">
|
||||
<field name="name">reservation.search</field>
|
||||
<field name="model">golem.reservation</field>
|
||||
<!-- 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 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"/>
|
||||
<filter name="Reservations_to_validate" string="Reservation to Validate"
|
||||
domain="[('status', '=', 'confirmed')]"/>
|
||||
<search>
|
||||
<field name="date_start" />
|
||||
<field name="date_stop" />
|
||||
<field name="resource_id" />
|
||||
<field name="user_id" />
|
||||
<field name="partner_id" />
|
||||
<field name="status" />
|
||||
<filter name="to_validate" string="Reservation to Validate"
|
||||
domain="[('status', '=', 'confirmed')]" />
|
||||
</search>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- action relative au menu réservation-->
|
||||
<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,search,form,calendar</field>
|
||||
</record>
|
||||
<menuitem id="resource_reservation_menu" name="Reservations"
|
||||
parent="resources_menu" action="action_reservation" sequence="20" />
|
||||
<!-- Actions -->
|
||||
<act_window id="golem_resource_reservation_action" name="Reservations"
|
||||
res_model="golem.resource.reservation" view_mode="tree,form,calendar" />
|
||||
|
||||
<!-- Menus -->
|
||||
<menuitem id="golem_resource_reservation_menu" name="Reservations"
|
||||
parent="golem_resource_menu" action="golem_resource_reservation_action"
|
||||
sequence="20" />
|
||||
|
||||
</data>
|
||||
</odoo>
|
||||
|
@ -18,104 +18,76 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
-->
|
||||
<odoo>
|
||||
<data>
|
||||
<!-- Remplissage du modele golem.weekday par les jours de la semaine -->
|
||||
<record model="golem.weekday" id="6">
|
||||
|
||||
<field name="name">Sunday</field>
|
||||
<field name="id_day">6</field>
|
||||
</record>
|
||||
<record model="golem.weekday" id="0">
|
||||
<field name="name">Monday</field>
|
||||
<field name="id_day">0</field>
|
||||
</record>
|
||||
<record model="golem.weekday" id="1">
|
||||
<field name="name">Tuesday</field>
|
||||
<field name="id_day">1</field>
|
||||
</record>
|
||||
<record model="golem.weekday" id="2">
|
||||
<field name="name">wednesday</field>
|
||||
<field name="id_day">2</field>
|
||||
</record>
|
||||
<record model="golem.weekday" id="3">
|
||||
<field name="name">Thursday</field>
|
||||
<field name="id_day">3</field>
|
||||
</record>
|
||||
<record model="golem.weekday" id="4">
|
||||
<field name="name">Friday</field>
|
||||
<field name="id_day">4</field>
|
||||
</record>
|
||||
<record model="golem.weekday" id="5">
|
||||
<field name="name">Saturday</field>
|
||||
<field name="id_day">5</field>
|
||||
</record>
|
||||
|
||||
<!--formulaire de recherche et filtrage du modèle golem.resources-->
|
||||
|
||||
<record model="ir.ui.view" id="resource_search_view">
|
||||
<field name="name">resource.search</field>
|
||||
<field name="model">golem.resources</field>
|
||||
<!-- Searches -->
|
||||
<record model="ir.ui.view" id="golem_resource_view_search">
|
||||
<field name="name">GOLEM Resource search</field>
|
||||
<field name="model">golem.resource</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 name="name" />
|
||||
<field name="type_id" />
|
||||
<field name="supervisor_id" />
|
||||
<field name="product_tmpl_id" />
|
||||
</search>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!--liste d'affichage du modèle golem.resources-->
|
||||
<record model="ir.ui.view" id="resource_tree_view">
|
||||
<field name="name">resource.tree</field>
|
||||
<field name="model">golem.resources</field>
|
||||
<!-- Trees -->
|
||||
<record model="ir.ui.view" id="golem_resource_view_tree">
|
||||
<field name="name">GOLEM Resource Tree</field>
|
||||
<field name="model">golem.resource</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Resource Form">
|
||||
<field name="name"/>
|
||||
<field name="validation_required"/>
|
||||
<field name="resource_type"/>
|
||||
<field name="resource_responsible"/>
|
||||
<field name="article_link"/>
|
||||
<field name="start_of_availability_date"/>
|
||||
<field name="end_of_availability_date"/>
|
||||
<tree>
|
||||
<field name="name" />
|
||||
<field name="type_id" />
|
||||
<field name="supervisor_id" />
|
||||
<field name="product_tmpl_id" />
|
||||
<field name="avaibility_start" />
|
||||
<field name="avaibility_stop" />
|
||||
<field name="validation_required" />
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!--formulaire du modèle golem.resources-->
|
||||
<record model="ir.ui.view" id="resource_form_view">
|
||||
<field name="name">resource.form</field>
|
||||
<field name="model">golem.resources</field>
|
||||
<!-- Forms -->
|
||||
<record model="ir.ui.view" id="golem_resource_view_form">
|
||||
<field name="name">GOLEM Resource Form</field>
|
||||
<field name="model">golem.resource</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Resource Form">
|
||||
<form>
|
||||
<sheet>
|
||||
<div class="oe_button_box" name="button_box" groups="base.group_user">
|
||||
<button class="oe_stat_button" icon="fa-archive" name="active_change" type="object"
|
||||
align="right">
|
||||
<field name="active" widget="boolean_button" options='{"terminology": "archive"}'/>
|
||||
<div class="oe_button_box" name="button_box">
|
||||
<button class="oe_stat_button" icon="fa-archive"
|
||||
name="active_toggle" type="object">
|
||||
<field name="active" widget="boolean_button"
|
||||
options="{'terminology': 'archive'}" />
|
||||
</button>
|
||||
</div>
|
||||
<group colspan="2">
|
||||
<group colspan="4" col="4">
|
||||
<field name="name"/>
|
||||
<field name="validation_required"/>
|
||||
<field name="resource_type"/>
|
||||
<field name="resource_responsible"/>
|
||||
<field name="article_link"/>
|
||||
<field name="type_id"/>
|
||||
<field name="supervisor_id"/>
|
||||
<field name="product_tmpl_id"/>
|
||||
</group>
|
||||
<field name="id" invisible="1"/>
|
||||
<group colspan="3">
|
||||
<separator string="Availibility configuration" colspan="3"/>
|
||||
<field name="start_of_availability_date"/>
|
||||
<field name="end_of_availability_date"/>
|
||||
<field name="avaibility_start"/>
|
||||
<field name="avaibility_stop"/>
|
||||
</group>
|
||||
<label string="Please save the resource before fixing the timetable availibility" attrs="{'invisible': [('id', '!=', False)]}"/>
|
||||
<group colspan="3">
|
||||
<field name="timetable" context="{'default_resource_id': active_id}" attrs="{'readonly': [('id', '=', False)]}">
|
||||
<field name="timetable_ids"
|
||||
context="{'default_resource_id': active_id}"
|
||||
attrs="{'readonly': [('id', '=', False)]}">
|
||||
<tree editable="bottom" >
|
||||
<field name="resource_id" invisible="1"/>
|
||||
<field name="name" />
|
||||
<field name="start_time" />
|
||||
<field name="end_time" />
|
||||
<field name="resource_id" invisible="1" />
|
||||
<field name="weekday" />
|
||||
<field name="time_start" widget="float_time" />
|
||||
<field name="time_stop" widget="float_time" />
|
||||
</tree>
|
||||
</field>
|
||||
</group>
|
||||
@ -125,42 +97,37 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!--action du sous menu Resources-->
|
||||
<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>
|
||||
<!-- Actions -->
|
||||
<act_window id="golem_resource_action" name="Resources"
|
||||
res_model="golem.resource" view_mode="tree,form" />
|
||||
|
||||
|
||||
<!--liste d'affichage du modèle golem.resources-->
|
||||
<record model="ir.ui.view" id="resourcetype_tree_view">
|
||||
<field name="name">resourcetype.tree</field>
|
||||
<field name="model">golem.resourcetype</field>
|
||||
<!-- Trees -->
|
||||
<record model="ir.ui.view" id="golem_resource_type_view_tree">
|
||||
<field name="name">GOLEM Resource Type Tree</field>
|
||||
<field name="model">golem.resource.type</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree editable="bottom" string="Resource Type Form">
|
||||
<field name="name"/>
|
||||
<tree editable="bottom">
|
||||
<field name="name" />
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!--action du sous menu configuration-->
|
||||
<record model="ir.actions.act_window" id="action_configuration">
|
||||
<field name="name">Resources Type</field>
|
||||
<field name="res_model">golem.resourcetype</field>
|
||||
<field name="view_mode">tree</field>
|
||||
</record>
|
||||
<!--menu principale et sous menu-->
|
||||
<menuitem id="resources_menu" name="Resources"
|
||||
<!-- Actions -->
|
||||
<act_window id="golem_resource_type_action" name="Resource Types"
|
||||
res_model="golem.resource.type" view_mode="tree" />
|
||||
|
||||
<!-- Menus -->
|
||||
<menuitem id="golem_resource_menu" name="Resources"
|
||||
sequence="55" groups="golem_base.group_golem_user"
|
||||
web_icon="golem_ressources,static/description/icon.png" />
|
||||
<menuitem id="resources_list_menu" name="Resources" parent="resources_menu"
|
||||
action="action_resources" sequence="10" />
|
||||
<menuitem id="resources_list_menu" name="Resources" parent="golem_resource_menu"
|
||||
action="golem_resource_action" sequence="10" />
|
||||
<menuitem id="resource_configuration_menu" name="Configuration"
|
||||
parent="resources_menu" groups="golem_base.group_golem_manager"
|
||||
action="action_configuration" sequence="90" />
|
||||
parent="golem_resource_menu" groups="golem_base.group_golem_manager"
|
||||
sequence="90" />
|
||||
<menuitem id="resource_cofiguration_type_menu" name="Resource Types"
|
||||
parent="resource_configuration_menu"
|
||||
action="action_configuration" sequence="10" />
|
||||
action="golem_resource_type_action" sequence="10" />
|
||||
|
||||
</data>
|
||||
</odoo>
|
||||
|
@ -24,7 +24,7 @@ class GolemReservationRejectionWizard(models.TransientModel):
|
||||
"""GOLEM Resource wizard : refusal reason for a reservation """
|
||||
_name = "golem.reservation.rejection.wizard"
|
||||
|
||||
reservation_id = fields.Many2one('golem.reservation', required=True)
|
||||
reservation_id = fields.Many2one('golem.resource.reservation', required=True)
|
||||
reason = fields.Text(required=True)
|
||||
|
||||
@api.multi
|
||||
|
@ -20,7 +20,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
<data>
|
||||
|
||||
<!-- Forms -->
|
||||
<record model="ir.ui.view" id="golem_reservation_rejection_wizard_form_view">
|
||||
<record model="ir.ui.view" id="golem_reservation_rejection_wizard_view_form">
|
||||
<field name="name">GOLEM Reservation Rejection Wizard Form</field>
|
||||
<field name="model">golem.reservation.rejection.wizard</field>
|
||||
<field name="arch" type="xml">
|
||||
|
Loading…
Reference in New Issue
Block a user