Ajout des smart button pour la liste des reservation et calendrier du resource en cours
This commit is contained in:
parent
dfe47d1d96
commit
8e51e46a0b
@ -67,6 +67,8 @@ class GolemResourceReservation(models.Model):
|
||||
|
||||
rejection_reason = fields.Text(readonly=True, track_visibility='onchange')
|
||||
|
||||
resource_reservation_count = fields.Integer(compute='_reservation_count')
|
||||
|
||||
@api.depends('resource_id', 'date')
|
||||
def _compute_name(self):
|
||||
""" Computes reservation name """
|
||||
@ -199,3 +201,41 @@ class GolemResourceReservation(models.Model):
|
||||
'please choose another périod before confirming.')
|
||||
raise ValidationError(verr.format(other_res.date_start,
|
||||
other_res.date_stop))
|
||||
@api.multi
|
||||
def reservation_calendar(self):
|
||||
""" current resource reservation list """
|
||||
self.ensure_one()
|
||||
calendar_view = {
|
||||
'name': ('Resource Reservation list'),
|
||||
'view_mode': 'calendar',
|
||||
'res_model': 'golem.resource.reservation',
|
||||
'view_id': False,
|
||||
'domain': [('resource_id', '=', self.resource_id.id)],
|
||||
'type': 'ir.actions.act_window',
|
||||
'target':'new'
|
||||
}
|
||||
return calendar_view
|
||||
|
||||
@api.multi
|
||||
def reserveration_list(self):
|
||||
""" current resource reservation list """
|
||||
self.ensure_one()
|
||||
tree_view = {
|
||||
'name': ('Resource Reservation list'),
|
||||
'view_mode': 'tree',
|
||||
'res_model': 'golem.resource.reservation',
|
||||
'view_id': False,
|
||||
'domain': [('resource_id', '=', self.resource_id.id)],
|
||||
'type': 'ir.actions.act_window',
|
||||
'target':'new'
|
||||
}
|
||||
return tree_view
|
||||
|
||||
@api.multi
|
||||
@api.depends('resource_id')
|
||||
def _reservation_count(self):
|
||||
for reservation in self:
|
||||
count = reservation.search_count([('resource_id', '=', reservation.resource_id.id)])
|
||||
reservation.resource_reservation_count = count
|
||||
print "__________________________________"
|
||||
print count
|
||||
|
@ -70,6 +70,17 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
<field name="state" widget="statusbar" />
|
||||
</header>
|
||||
<sheet>
|
||||
<div class="oe_button_box" name="button_box">
|
||||
<button class="oe_stat_button" icon="fa-list"
|
||||
name="reserveration_list" type="object">
|
||||
<field string="Reservation" name="resource_reservation_count"
|
||||
widget="statinfo"/>
|
||||
</button>
|
||||
<button class="oe_stat_button" icon="fa-calendar"
|
||||
name="reservation_calendar" type="object">
|
||||
<label string="Calendar"/>
|
||||
</button>
|
||||
</div>
|
||||
<group>
|
||||
<group string="Resource">
|
||||
<field name="id" invisible="1" />
|
||||
|
Loading…
Reference in New Issue
Block a user