[REF]GOLEM Resources : huge code refactoring, renamings etc.

This commit is contained in:
Fabien BOURGEOIS 2018-02-18 12:25:11 +01:00
parent 2b70d2c1b0
commit fe0d57dffc
7 changed files with 285 additions and 258 deletions

View File

@ -20,7 +20,7 @@
'name': 'GOLEM non-profit resources', 'name': 'GOLEM non-profit resources',
'summary': 'GOLEM resources management', 'summary': 'GOLEM resources management',
'description': ''' GOLEM resources management ''', 'description': ''' GOLEM resources management ''',
'version': '10.0.1.0.4', 'version': '10.0.1.1.0',
'category': 'GOLEM', 'category': 'GOLEM',
'author': 'Youssef El Ouahby, Fabien Bourgeois', 'author': 'Youssef El Ouahby, Fabien Bourgeois',
'license': 'AGPL-3', 'license': 'AGPL-3',

View File

@ -18,73 +18,120 @@
""" GOLEM Resources management """ """ 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 #modèle de base : ressources
class GolemResources(models.Model): class GolemResource(models.Model):
""" GOLEM Resources """ """ GOLEM Resource Model """
_name = 'golem.resources' _name = 'golem.resource'
_description = 'GOLEM Resources' _description = 'GOLEM Resource Model'
name = fields.Char(required=True) name = fields.Char(required=True, index=True)
active = fields.Boolean(default=True) active = fields.Boolean(default=True)
validation_required = fields.Boolean(default=True) validation_required = fields.Boolean(default=True,
resource_type = fields.Many2one("golem.resourcetype") string='Is validation required ?')
resource_responsible = fields.Many2one("res.partner") type_id = fields.Many2one('golem.resource.type',
article_link = fields.Many2one("product.template") 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) avaibility_start = fields.Date(required=True, string='Availibility start date')
start_of_availability_date = fields.Date(required=True) avaibility_stop = fields.Date(required=True, string='Availibility stop date')
end_of_availability_date = fields.Date(required=True) timetable_ids = fields.One2many('golem.resource.timetable', 'resource_id',
timetable = fields.One2many("golem.timetable", "resource_id", string="Availibility timetable") string='Availibility timetable')
reservation = fields.One2many("golem.reservation", "linked_resource") reservation_ids = fields.One2many('golem.resource.reservation', 'resource_id',
string='Reservations')
@api.multi @api.multi
def active_change(self): def active_toggle(self):
self.active = not self.active """ 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 name = fields.Char(compute='_compute_name', store=True)
class GolemReservation(models.Model): # TODO: handle multiple days reservation
""" GOLEM Reservation """ date = fields.Date(required=True, index=True)
_name = 'golem.reservation' hour_start = fields.Float('Start hour', required=True)
_description = 'GOLEM Reservation' 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() resource_id = fields.Many2one('golem.resource', required=True, index=True,
end_date = fields.Datetime() string='Resource')
linked_resource = fields.Many2one('golem.resources', required=True) user_id = fields.Many2one('res.users', required=True, index=True,
user = fields.Many2one('res.users', required=True, default=lambda self: self.env.user) string='User',
on_behalf_of = fields.Many2one('res.partner', required=True, default=lambda self: self.env['res.partner']) default=lambda self: self.env.user)
rejection_reason = fields.Text() partner_id = fields.Many2one('res.partner', string='On behalf of',
required=True, index=True)
status = fields.Selection([ status = fields.Selection([
('draft', "Draft"), ('draft', 'Draft'),
('confirmed', "Confirmed"), ('confirmed', 'Confirmed'),
('canceled', "Canceled"), ('canceled', 'Canceled'),
('validated', "Validated"), ('validated', 'Validated'),
('rejected', "Rejected"), ('rejected', 'Rejected'),
], default='draft') ], 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 @api.multi
def status_draft(self): def status_draft(self):
self.status = 'draft' """ Status to draft """
self.write({'status': 'draft'})
@api.multi @api.multi
def status_confirm(self): def status_confirm(self):
self.status = 'confirmed' """ Confirms reservation, or validates it if not workflow is involved """
if( not self.linked_resource.validation_required) : for reservation in self:
self.status='validated' if reservation.resource_id.validation_required:
reservation.status = 'confirmed'
else:
reservation.status_validated()
@api.multi @api.multi
def status_canceled(self): def status_canceled(self):
self.status = 'canceled' """ Status to cancel """
self.write({'status': 'canceled'})
@api.multi @api.multi
def status_validated(self): def status_validated(self):
self.status = 'validated' """ Status to validated """
self.write({'status': 'validated'})
@api.multi @api.multi
def status_rejected(self): def status_rejected(self):
@ -100,68 +147,84 @@ class GolemReservation(models.Model):
@api.constrains('status') @api.constrains('status')
def _onConfirmReservation(self): def check_confirmed(self):
if self.status == 'confirmed': """ Check date coherence on reservation confirmation """
#verifyin is the reservation is taking place out of the resource availibility period for reservation in self:
if(self.start_date < self.linked_resource.start_of_availability_date or self.end_date > self.linked_resource.end_of_availability_date ): if reservation.status == 'confirmed':
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) # Check is reservation is not taking place out of the resource avaibility period
else : if reservation.date < reservation.resource_id.avaibility_start or \
#verifying if the reservation is taking place out the availibility timetable reservation.date > reservation.resource_id.avaibility_stop:
#defining a boolean flag, which will determine if the day of the reservation is available uerr = _('Not allowed, the resource is not available in '
r_allowed = False 'this period, please choose another périod before '
for day in self.linked_resource.timetable : 'confirming')
#if the day is available, look for the time if it's inside the resource timetable availibility raise UserError(uerr)
if day.name.id_day == fields.Datetime.from_string(self.start_date).weekday(): # Check if reservation is not taking place out the avaibility timetables
start_hour = fields.Datetime.from_string(self.start_date).hour is_day_allowed = False
start_min = float(fields.Datetime.from_string(self.start_date).minute) #+(int(fields.Datetime.from_string(self.start_date).min))/100 for timetable in reservation.resource_id.timetable_ids:
start_time_r = start_hour + start_min/100 # Check for the time according to resource timetable avaibility
start_hour = fields.Datetime.from_string(self.end_date).hour date = fields.Datetime.from_string(reservation.date)
start_min = float(fields.Datetime.from_string(self.end_date).minute) #+(int(fields.Datetime.from_string(self.start_date).min))/100 if int(timetable.weekday) == date.weekday():
end_time_r = start_hour + start_min/100 is_day_allowed = True
#if the time is suitable, the flag state is changed if reservation.hour_start < timetable.date_start or \
if(start_time_r > day.start_time and end_time_r < day.end_time): reservation.hour_stop > timetable.date_stop:
r_allowed = True uerr = _('Not allowed, the resource is not available '
#if the flag is changed no erreur is raised. 'during this period, please choose another '
if(not r_allowed): 'time before confirming.')
raise exceptions.UserError("Not allowed, the resource is not available during this timetable, please choose another time before confirming ") raise UserError(uerr)
#verifying if the resource is already taken during this period if not is_day_allowed:
for reservation in self.linked_resource.reservation : uerr = _('Not allowed, the resource is not available '
if(self.id != reservation.id and reservation.status == 'confirmed' and not (self.end_date < reservation.start_date or self.start_date > reservation.end_date)): 'this day. Please choose another date.')
raise exceptions.UserError("Not allowed, the resource is taken during this period, please choose another période before confirming ") raise UserError(uerr)
elif (not self.linked_resource.validation_required): # Check if the resource is already taken during this period
self.status = 'validated' # 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): class GolemResourceType(models.Model):
""" GOLEM Resource Type """ """ GOLEM Resource Type """
_name = 'golem.resourcetype' _name = 'golem.resource.type'
_description = '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): class GolemTimetable(models.Model):
""" Golem Timetable """ """ Golem Timetable """
_name = "golem.timetable" _name = "golem.resource.timetable"
_description = "Golem Timetable" _description = "Golem Timetable"
_rec_name = 'weekday'
resource_id = fields.Many2one("golem.resources", required=True) resource_id = fields.Many2one('golem.resource', required=True,
name = fields.Many2one("golem.weekday", required=True) string='Linked resource')
start_time = fields.Float(required=True) weekday = fields.Selection([('0', _('Monday')),
end_time = fields.Float(required=True) ('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): def _check_time_consistency(self):
if self.end_time < self.start_time: for timetable in self:
raise exceptions.ValidationError(_('End time should be higher than start time')) if timetable.time_stop < timetable.time_start:
raise ValidationError(_('End time should be after than start time'))

View File

@ -1,3 +1,3 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink 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_resource_user,Access GOLEM Resources User,model_golem_resource,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_manager,Access GOLEM Resources Manager,model_golem_resource,golem_base.group_golem_manager,1,1,1,1
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
2 access_golem_resources_user access_golem_resource_user Access GOLEM Resources User model_golem_resources model_golem_resource golem_base.group_golem_user 1 0 0 0
3 access_golem_resources_manager access_golem_resource_manager Access GOLEM Resources Manager model_golem_resources model_golem_resource golem_base.group_golem_manager 1 1 1 1

View File

@ -18,66 +18,63 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
--> -->
<odoo> <odoo>
<data> <data>
<!--Calendrier des reservations-->
<record model="ir.ui.view" id="reservation_calendar_view"> <!-- Calendars -->
<field name="name">reservation.calendar</field> <record model="ir.ui.view" id="golem_resource_reservation_view_calendar">
<field name="model">golem.reservation</field> <field name="name">GOLEM Resource Reservation Calendar</field>
<field name="model">golem.resource.reservation</field>
<field name="arch" type="xml"> <field name="arch" type="xml">
<calendar string="Reservation Calendar" date_start="start_date" date_stop="end_date" <calendar date_start="date_start" date_stop="date_stop" color="resource_id">
color="linked_resource"> <field name="resource_id" />
<field name="linked_resource"/> <field name="user_id" />
<field name="user"/> <field name="partner_id" />
<field name="on_behalf_of"/>
</calendar> </calendar>
</field> </field>
</record> </record>
<!--liste des réservations --> <!-- Trees -->
<record model="ir.ui.view" id="reservation_tree_view"> <record model="ir.ui.view" id="golem_resource_reservation_view_tree">
<field name="name">reservation.tree</field> <field name="name">GOLEM Resource Reservation Tree</field>
<field name="model">golem.reservation</field> <field name="model">golem.resource.reservation</field>
<field name="arch" type="xml"> <field name="arch" type="xml">
<tree string="Reservation tree"> <tree>
<field name="start_date"/> <field name="date_start" />
<field name="end_date"/> <field name="date_stop" />
<field name="linked_resource"/> <field name="resource_id" />
<field name="user"/> <field name="user_id" />
<field name="on_behalf_of"/> <field name="partner_id" />
<field name="status" /> <field name="status" />
</tree> </tree>
</field> </field>
</record> </record>
<!--Formulaire de réservation de ressource--> <!-- Forms -->
<record model="ir.ui.view" id="reservation_form_view"> <record model="ir.ui.view" id="golem_resource_reservation_view_form">
<field name="name">reservation.form</field> <field name="name">GOLEM Resource Reservation Form</field>
<field name="model">golem.reservation</field> <field name="model">golem.resource.reservation</field>
<field name="arch" type="xml"> <field name="arch" type="xml">
<form string="Reservation Form"> <form>
<header> <header>
<button name="status_confirm" type="object" <button name="status_confirm" type="object"
string="Confirm" statuss="draft" string="Confirm" status="draft"
class="oe_highlight" /> class="oe_highlight" />
<button name="status_canceled" type="object" <button name="status_canceled" type="object"
string="Cancel" statuss="confirmed" string="Cancel" status="confirmed" />
class="oe_highlight"/>
<button name="status_validated" type="object" <button name="status_validated" type="object"
string="Validate" statuss="confirmed" string="Validate" status="confirmed"
class="oe_highlight" /> class="oe_highlight" />
<button name="status_rejected" type="object" <button name="status_rejected" type="object"
string="Reject" statuss="confirmed" string="Reject" status="confirmed"
class="oe_highlight" /> class="oe_highlight" />
<field name="status" widget="statusbar" /> <field name="status" widget="statusbar" />
</header> </header>
<sheet> <sheet>
<group> <group>
<field name="start_date"/> <field name="date_start" />
<field name="end_date"/> <field name="date_stop" />
<field name="linked_resource"/> <field name="resource_id" />
<field name="user"/> <field name="user_id" />
<field name="on_behalf_of"/> <field name="partner_id" />
<field name="rejection_reason" /> <field name="rejection_reason" />
</group> </group>
</sheet> </sheet>
@ -85,32 +82,32 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
</field> </field>
</record> </record>
<!-- recherche relative au menu reservation--> <!-- Searches -->
<record model="ir.ui.view" id="reservation_search_view"> <record model="ir.ui.view" id="golem_resource_reservation_view_search">
<field name="name">reservation.search</field> <field name="name">GOLEM Resource Reservation Search</field>
<field name="model">golem.reservation</field> <field name="model">golem.resource.reservation</field>
<field name="arch" type="xml"> <field name="arch" type="xml">
<search string="Reservation tree"> <search>
<field name="start_date"/> <field name="date_start" />
<field name="end_date"/> <field name="date_stop" />
<field name="linked_resource"/> <field name="resource_id" />
<field name="user"/> <field name="user_id" />
<field name="on_behalf_of"/> <field name="partner_id" />
<field name="status" /> <field name="status" />
<filter name="Reservations_to_validate" string="Reservation to Validate" <filter name="to_validate" string="Reservation to Validate"
domain="[('status', '=', 'confirmed')]" /> domain="[('status', '=', 'confirmed')]" />
</search> </search>
</field> </field>
</record> </record>
<!-- action relative au menu réservation--> <!-- Actions -->
<record model="ir.actions.act_window" id="action_reservation"> <act_window id="golem_resource_reservation_action" name="Reservations"
<field name="name">Reservation</field> res_model="golem.resource.reservation" view_mode="tree,form,calendar" />
<field name="res_model">golem.reservation</field>
<field name="view_mode">tree,search,form,calendar</field> <!-- Menus -->
</record> <menuitem id="golem_resource_reservation_menu" name="Reservations"
<menuitem id="resource_reservation_menu" name="Reservations" parent="golem_resource_menu" action="golem_resource_reservation_action"
parent="resources_menu" action="action_reservation" sequence="20" /> sequence="20" />
</data> </data>
</odoo> </odoo>

View File

@ -18,104 +18,76 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
--> -->
<odoo> <odoo>
<data> <data>
<!-- Remplissage du modele golem.weekday par les jours de la semaine -->
<record model="golem.weekday" id="6">
<field name="name">Sunday</field> <!-- Searches -->
<field name="id_day">6</field> <record model="ir.ui.view" id="golem_resource_view_search">
</record> <field name="name">GOLEM Resource search</field>
<record model="golem.weekday" id="0"> <field name="model">golem.resource</field>
<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>
<field name="arch" type="xml"> <field name="arch" type="xml">
<search string="Resource Search"> <search>
<field name="name" /> <field name="name" />
<field name="resource_type"/> <field name="type_id" />
<field name="resource_responsible"/> <field name="supervisor_id" />
<field name="article_link"/> <field name="product_tmpl_id" />
</search> </search>
</field> </field>
</record> </record>
<!--liste d'affichage du modèle golem.resources--> <!-- Trees -->
<record model="ir.ui.view" id="resource_tree_view"> <record model="ir.ui.view" id="golem_resource_view_tree">
<field name="name">resource.tree</field> <field name="name">GOLEM Resource Tree</field>
<field name="model">golem.resources</field> <field name="model">golem.resource</field>
<field name="arch" type="xml"> <field name="arch" type="xml">
<tree string="Resource Form"> <tree>
<field name="name" /> <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" /> <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> </tree>
</field> </field>
</record> </record>
<!--formulaire du modèle golem.resources--> <!-- Forms -->
<record model="ir.ui.view" id="resource_form_view"> <record model="ir.ui.view" id="golem_resource_view_form">
<field name="name">resource.form</field> <field name="name">GOLEM Resource Form</field>
<field name="model">golem.resources</field> <field name="model">golem.resource</field>
<field name="arch" type="xml"> <field name="arch" type="xml">
<form string="Resource Form"> <form>
<sheet> <sheet>
<div class="oe_button_box" name="button_box" groups="base.group_user"> <div class="oe_button_box" name="button_box">
<button class="oe_stat_button" icon="fa-archive" name="active_change" type="object" <button class="oe_stat_button" icon="fa-archive"
align="right"> name="active_toggle" type="object">
<field name="active" widget="boolean_button" options='{"terminology": "archive"}'/> <field name="active" widget="boolean_button"
options="{'terminology': 'archive'}" />
</button> </button>
</div> </div>
<group colspan="2"> <group colspan="2">
<group colspan="4" col="4"> <group colspan="4" col="4">
<field name="name"/> <field name="name"/>
<field name="validation_required"/> <field name="validation_required"/>
<field name="resource_type"/> <field name="type_id"/>
<field name="resource_responsible"/> <field name="supervisor_id"/>
<field name="article_link"/> <field name="product_tmpl_id"/>
</group> </group>
<field name="id" invisible="1"/> <field name="id" invisible="1"/>
<group colspan="3"> <group colspan="3">
<separator string="Availibility configuration" colspan="3"/> <separator string="Availibility configuration" colspan="3"/>
<field name="start_of_availability_date"/> <field name="avaibility_start"/>
<field name="end_of_availability_date"/> <field name="avaibility_stop"/>
</group> </group>
<label string="Please save the resource before fixing the timetable availibility" attrs="{'invisible': [('id', '!=', False)]}"/> <label string="Please save the resource before fixing the timetable availibility" attrs="{'invisible': [('id', '!=', False)]}"/>
<group colspan="3"> <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" > <tree editable="bottom" >
<field name="resource_id" invisible="1" /> <field name="resource_id" invisible="1" />
<field name="name" /> <field name="weekday" />
<field name="start_time" /> <field name="time_start" widget="float_time" />
<field name="end_time" /> <field name="time_stop" widget="float_time" />
</tree> </tree>
</field> </field>
</group> </group>
@ -125,42 +97,37 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
</field> </field>
</record> </record>
<!--action du sous menu Resources--> <!-- Actions -->
<record model="ir.actions.act_window" id="action_resources"> <act_window id="golem_resource_action" name="Resources"
<field name="name">Resources</field> res_model="golem.resource" view_mode="tree,form" />
<field name="res_model">golem.resources</field>
<field name="view_mode">tree,form,search</field>
</record>
<!-- Trees -->
<!--liste d'affichage du modèle golem.resources--> <record model="ir.ui.view" id="golem_resource_type_view_tree">
<record model="ir.ui.view" id="resourcetype_tree_view"> <field name="name">GOLEM Resource Type Tree</field>
<field name="name">resourcetype.tree</field> <field name="model">golem.resource.type</field>
<field name="model">golem.resourcetype</field>
<field name="arch" type="xml"> <field name="arch" type="xml">
<tree editable="bottom" string="Resource Type Form"> <tree editable="bottom">
<field name="name" /> <field name="name" />
</tree> </tree>
</field> </field>
</record> </record>
<!--action du sous menu configuration--> <!-- Actions -->
<record model="ir.actions.act_window" id="action_configuration"> <act_window id="golem_resource_type_action" name="Resource Types"
<field name="name">Resources Type</field> res_model="golem.resource.type" view_mode="tree" />
<field name="res_model">golem.resourcetype</field>
<field name="view_mode">tree</field> <!-- Menus -->
</record> <menuitem id="golem_resource_menu" name="Resources"
<!--menu principale et sous menu-->
<menuitem id="resources_menu" name="Resources"
sequence="55" groups="golem_base.group_golem_user" sequence="55" groups="golem_base.group_golem_user"
web_icon="golem_ressources,static/description/icon.png" /> web_icon="golem_ressources,static/description/icon.png" />
<menuitem id="resources_list_menu" name="Resources" parent="resources_menu" <menuitem id="resources_list_menu" name="Resources" parent="golem_resource_menu"
action="action_resources" sequence="10" /> action="golem_resource_action" sequence="10" />
<menuitem id="resource_configuration_menu" name="Configuration" <menuitem id="resource_configuration_menu" name="Configuration"
parent="resources_menu" groups="golem_base.group_golem_manager" parent="golem_resource_menu" groups="golem_base.group_golem_manager"
action="action_configuration" sequence="90" /> sequence="90" />
<menuitem id="resource_cofiguration_type_menu" name="Resource Types" <menuitem id="resource_cofiguration_type_menu" name="Resource Types"
parent="resource_configuration_menu" parent="resource_configuration_menu"
action="action_configuration" sequence="10" /> action="golem_resource_type_action" sequence="10" />
</data> </data>
</odoo> </odoo>

View File

@ -24,7 +24,7 @@ class GolemReservationRejectionWizard(models.TransientModel):
"""GOLEM Resource wizard : refusal reason for a reservation """ """GOLEM Resource wizard : refusal reason for a reservation """
_name = "golem.reservation.rejection.wizard" _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) reason = fields.Text(required=True)
@api.multi @api.multi

View File

@ -20,7 +20,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<data> <data>
<!-- Forms --> <!-- 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="name">GOLEM Reservation Rejection Wizard Form</field>
<field name="model">golem.reservation.rejection.wizard</field> <field name="model">golem.reservation.rejection.wizard</field>
<field name="arch" type="xml"> <field name="arch" type="xml">