forked from Yaltik/golem
Merge branch 'master' into activity_report
This commit is contained in:
commit
5175f03f4f
@ -20,7 +20,7 @@
|
||||
'name': 'GOLEM resources invoicing',
|
||||
'summary': 'GOLEM resources invoicing',
|
||||
'description': ''' GOLEM resources invoicing ''',
|
||||
'version': '10.0.0.2.0',
|
||||
'version': '10.0.0.3.0',
|
||||
'category': 'GOLEM',
|
||||
'author': 'Youssef El Ouahby, Fabien Bourgeois',
|
||||
'license': 'AGPL-3',
|
||||
|
@ -75,8 +75,13 @@ class GolemResourceReservation(models.Model):
|
||||
product.categ_id.property_account_income_categ_id.id
|
||||
delta = fields.Datetime.from_string(reservation.date_stop) - \
|
||||
fields.Datetime.from_string(reservation.date_start)
|
||||
quantity = (delta.days * 24) + (delta.seconds/3600.0)
|
||||
|
||||
quantity = 1.0
|
||||
# Make quantity coherent with UoM
|
||||
if product.uom_id in (self.env.ref('product.product_uom_hour'),
|
||||
self.env.ref('product.product_uom_unit')):
|
||||
quantity = int(round((delta.days * 24.0) + (delta.seconds/3600.0)))
|
||||
elif product.uom_id == self.env.ref('product.product_uom_day'):
|
||||
quantity = int(round(delta.days + (delta.seconds/86400.0)))
|
||||
line_id = self.env['account.invoice.line'].create({
|
||||
'invoice_id': invoice_id.id,
|
||||
'name': product.name,
|
||||
|
@ -20,7 +20,7 @@
|
||||
'name': 'GOLEM resources pack',
|
||||
'summary': 'GOLEM resources pack',
|
||||
'description': ''' GOLEM resources pack ''',
|
||||
'version': '10.0.0.0.5',
|
||||
'version': '10.0.0.1.0',
|
||||
'category': 'GOLEM',
|
||||
'author': 'Youssef El Ouahby, Fabien Bourgeois',
|
||||
'license': 'AGPL-3',
|
||||
@ -29,5 +29,6 @@
|
||||
'depends': ['golem_resource'],
|
||||
'data': ['views/golem_resource_pack_views.xml',
|
||||
'wizard/golem_pack_rejection_views.xml',
|
||||
'wizard/golem_pack_quick_reservation_views.xml',
|
||||
'security/ir.model.access.csv']
|
||||
}
|
||||
|
@ -6,8 +6,8 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Odoo Server 10.0\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2018-04-17 06:51+0000\n"
|
||||
"PO-Revision-Date: 2018-04-17 06:51+0000\n"
|
||||
"POT-Creation-Date: 2018-05-25 16:47+0000\n"
|
||||
"PO-Revision-Date: 2018-05-25 16:47+0000\n"
|
||||
"Last-Translator: <>\n"
|
||||
"Language-Team: \n"
|
||||
"MIME-Version: 1.0\n"
|
||||
@ -16,6 +16,7 @@ msgstr ""
|
||||
"Plural-Forms: \n"
|
||||
|
||||
#. module: golem_resource_pack
|
||||
#: model:ir.ui.view,arch_db:golem_resource_pack.golem_pack_quick_reservation_wizard_view_form
|
||||
#: model:ir.ui.view,arch_db:golem_resource_pack.golem_pack_rejection_wizard_view_form
|
||||
#: model:ir.ui.view,arch_db:golem_resource_pack.golem_resource_pack_view_form
|
||||
msgid "Cancel"
|
||||
@ -37,18 +38,26 @@ msgid "Confirmed"
|
||||
msgstr "Confirmé"
|
||||
|
||||
#. module: golem_resource_pack
|
||||
#: model:ir.ui.view,arch_db:golem_resource_pack.golem_pack_quick_reservation_wizard_view_form
|
||||
msgid "Create Reservations"
|
||||
msgstr "Créer les réservations"
|
||||
|
||||
#. module: golem_resource_pack
|
||||
#: model:ir.model.fields,field_description:golem_resource_pack.field_golem_pack_quick_reservation_wizard_create_uid
|
||||
#: model:ir.model.fields,field_description:golem_resource_pack.field_golem_pack_rejection_wizard_create_uid
|
||||
#: model:ir.model.fields,field_description:golem_resource_pack.field_golem_resource_pack_create_uid
|
||||
msgid "Created by"
|
||||
msgstr "Créé par"
|
||||
|
||||
#. module: golem_resource_pack
|
||||
#: model:ir.model.fields,field_description:golem_resource_pack.field_golem_pack_quick_reservation_wizard_create_date
|
||||
#: model:ir.model.fields,field_description:golem_resource_pack.field_golem_pack_rejection_wizard_create_date
|
||||
#: model:ir.model.fields,field_description:golem_resource_pack.field_golem_resource_pack_create_date
|
||||
msgid "Created on"
|
||||
msgstr "Créé le"
|
||||
|
||||
#. module: golem_resource_pack
|
||||
#: model:ir.model.fields,field_description:golem_resource_pack.field_golem_pack_quick_reservation_wizard_display_name
|
||||
#: model:ir.model.fields,field_description:golem_resource_pack.field_golem_pack_rejection_wizard_display_name
|
||||
#: model:ir.model.fields,field_description:golem_resource_pack.field_golem_resource_pack_display_name
|
||||
msgid "Display Name"
|
||||
@ -59,6 +68,11 @@ msgstr "Nom affiché"
|
||||
msgid "Draft"
|
||||
msgstr "Brouillon"
|
||||
|
||||
#. module: golem_resource_pack
|
||||
#: model:ir.model,name:golem_resource_pack.model_golem_pack_quick_reservation_wizard
|
||||
msgid "GOLEM Pack Quick Reservation Wizard"
|
||||
msgstr "GOLEM Pack Quick Reservation Wizard"
|
||||
|
||||
#. module: golem_resource_pack
|
||||
#: model:ir.model,name:golem_resource_pack.model_golem_resource_reservation
|
||||
msgid "GOLEM Reservation Model"
|
||||
@ -70,24 +84,28 @@ msgid "GOLEM Resource Pack Model"
|
||||
msgstr "GOLEM Resource Pack Model"
|
||||
|
||||
#. module: golem_resource_pack
|
||||
#: model:ir.model.fields,field_description:golem_resource_pack.field_golem_pack_quick_reservation_wizard_id
|
||||
#: model:ir.model.fields,field_description:golem_resource_pack.field_golem_pack_rejection_wizard_id
|
||||
#: model:ir.model.fields,field_description:golem_resource_pack.field_golem_resource_pack_id
|
||||
msgid "ID"
|
||||
msgstr "ID"
|
||||
|
||||
#. module: golem_resource_pack
|
||||
#: model:ir.model.fields,field_description:golem_resource_pack.field_golem_pack_quick_reservation_wizard___last_update
|
||||
#: model:ir.model.fields,field_description:golem_resource_pack.field_golem_pack_rejection_wizard___last_update
|
||||
#: model:ir.model.fields,field_description:golem_resource_pack.field_golem_resource_pack___last_update
|
||||
msgid "Last Modified on"
|
||||
msgstr "Dernière Modification le"
|
||||
|
||||
#. module: golem_resource_pack
|
||||
#: model:ir.model.fields,field_description:golem_resource_pack.field_golem_pack_quick_reservation_wizard_write_uid
|
||||
#: model:ir.model.fields,field_description:golem_resource_pack.field_golem_pack_rejection_wizard_write_uid
|
||||
#: model:ir.model.fields,field_description:golem_resource_pack.field_golem_resource_pack_write_uid
|
||||
msgid "Last Updated by"
|
||||
msgstr "Dernière mise à jour par"
|
||||
|
||||
#. module: golem_resource_pack
|
||||
#: model:ir.model.fields,field_description:golem_resource_pack.field_golem_pack_quick_reservation_wizard_write_date
|
||||
#: model:ir.model.fields,field_description:golem_resource_pack.field_golem_pack_rejection_wizard_write_date
|
||||
#: model:ir.model.fields,field_description:golem_resource_pack.field_golem_resource_pack_write_date
|
||||
msgid "Last Updated on"
|
||||
@ -109,6 +127,7 @@ msgid "Notes, optional subject for the reservation, reason"
|
||||
msgstr "Notes, subjet, motif, descriptif optionnel pour la réservation"
|
||||
|
||||
#. module: golem_resource_pack
|
||||
#: model:ir.model.fields,field_description:golem_resource_pack.field_golem_pack_quick_reservation_wizard_partner_id
|
||||
#: model:ir.model.fields,field_description:golem_resource_pack.field_golem_resource_pack_partner_id
|
||||
msgid "On behalf of"
|
||||
msgstr "Pour le compte de"
|
||||
@ -119,22 +138,33 @@ msgid "Pack"
|
||||
msgstr "Lot"
|
||||
|
||||
#. module: golem_resource_pack
|
||||
#: model:ir.model.fields,field_description:golem_resource_pack.field_golem_pack_quick_reservation_wizard_pack_id
|
||||
#: model:ir.model.fields,field_description:golem_resource_pack.field_golem_pack_rejection_wizard_pack_id
|
||||
msgid "Pack id"
|
||||
msgstr "Lot"
|
||||
|
||||
#. module: golem_resource_pack
|
||||
#: code:addons/golem_resource_pack/models/golem_resource_pack.py:126
|
||||
#: code:addons/golem_resource_pack/models/golem_resource_pack.py:138
|
||||
#, python-format
|
||||
msgid "Pack partner should be the same for all reservations"
|
||||
msgstr "Toutes les réservations devraient avoir le même compte"
|
||||
|
||||
#. module: golem_resource_pack
|
||||
#: code:addons/golem_resource_pack/models/golem_resource_pack.py:108
|
||||
#: code:addons/golem_resource_pack/models/golem_resource_pack.py:120
|
||||
#, python-format
|
||||
msgid "Please enter the rejection reason"
|
||||
msgstr "Merci de saisir le motif de refus"
|
||||
|
||||
#. module: golem_resource_pack
|
||||
#: model:ir.ui.view,arch_db:golem_resource_pack.golem_resource_pack_view_form
|
||||
msgid "Quick Reservation"
|
||||
msgstr "Réservations rapides"
|
||||
|
||||
#. module: golem_resource_pack
|
||||
#: model:ir.ui.view,arch_db:golem_resource_pack.golem_pack_quick_reservation_wizard_view_form
|
||||
msgid "Quick Reservations"
|
||||
msgstr "Réservations rapides"
|
||||
|
||||
#. module: golem_resource_pack
|
||||
#: model:ir.model.fields,field_description:golem_resource_pack.field_golem_pack_rejection_wizard_reason
|
||||
msgid "Reason"
|
||||
@ -178,16 +208,37 @@ msgstr "Nombre de réservations"
|
||||
msgid "Reservations"
|
||||
msgstr "Réservations"
|
||||
|
||||
#. module: golem_resource_pack
|
||||
#: code:addons/golem_resource_pack/models/golem_resource_pack.py:60
|
||||
#, python-format
|
||||
msgid "Reservations Creation"
|
||||
msgstr "Création de réservations"
|
||||
|
||||
#. module: golem_resource_pack
|
||||
#: model:ir.model.fields,field_description:golem_resource_pack.field_golem_pack_quick_reservation_wizard_resource_ids
|
||||
msgid "Resource List"
|
||||
msgstr "Resource List"
|
||||
|
||||
#. module: golem_resource_pack
|
||||
#: model:ir.ui.view,arch_db:golem_resource_pack.golem_resource_pack_view_form
|
||||
msgid "Set to draft"
|
||||
msgstr "Brouillon"
|
||||
|
||||
#. module: golem_resource_pack
|
||||
#: model:ir.model.fields,field_description:golem_resource_pack.field_golem_pack_quick_reservation_wizard_date_start
|
||||
msgid "Start date"
|
||||
msgstr "Date de début"
|
||||
|
||||
#. module: golem_resource_pack
|
||||
#: model:ir.model.fields,field_description:golem_resource_pack.field_golem_resource_pack_state
|
||||
msgid "State"
|
||||
msgstr "État"
|
||||
|
||||
#. module: golem_resource_pack
|
||||
#: model:ir.model.fields,field_description:golem_resource_pack.field_golem_pack_quick_reservation_wizard_date_stop
|
||||
msgid "Stop date"
|
||||
msgstr "Date de fin"
|
||||
|
||||
#. module: golem_resource_pack
|
||||
#: model:ir.model.fields,field_description:golem_resource_pack.field_golem_resource_pack_user_id
|
||||
msgid "User"
|
||||
|
@ -6,8 +6,8 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Odoo Server 10.0\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2018-04-17 06:51+0000\n"
|
||||
"PO-Revision-Date: 2018-04-17 06:51+0000\n"
|
||||
"POT-Creation-Date: 2018-05-25 16:47+0000\n"
|
||||
"PO-Revision-Date: 2018-05-25 16:47+0000\n"
|
||||
"Last-Translator: <>\n"
|
||||
"Language-Team: \n"
|
||||
"MIME-Version: 1.0\n"
|
||||
@ -16,6 +16,7 @@ msgstr ""
|
||||
"Plural-Forms: \n"
|
||||
|
||||
#. module: golem_resource_pack
|
||||
#: model:ir.ui.view,arch_db:golem_resource_pack.golem_pack_quick_reservation_wizard_view_form
|
||||
#: model:ir.ui.view,arch_db:golem_resource_pack.golem_pack_rejection_wizard_view_form
|
||||
#: model:ir.ui.view,arch_db:golem_resource_pack.golem_resource_pack_view_form
|
||||
msgid "Cancel"
|
||||
@ -37,18 +38,26 @@ msgid "Confirmed"
|
||||
msgstr ""
|
||||
|
||||
#. module: golem_resource_pack
|
||||
#: model:ir.ui.view,arch_db:golem_resource_pack.golem_pack_quick_reservation_wizard_view_form
|
||||
msgid "Create Reservations"
|
||||
msgstr ""
|
||||
|
||||
#. module: golem_resource_pack
|
||||
#: model:ir.model.fields,field_description:golem_resource_pack.field_golem_pack_quick_reservation_wizard_create_uid
|
||||
#: model:ir.model.fields,field_description:golem_resource_pack.field_golem_pack_rejection_wizard_create_uid
|
||||
#: model:ir.model.fields,field_description:golem_resource_pack.field_golem_resource_pack_create_uid
|
||||
msgid "Created by"
|
||||
msgstr ""
|
||||
|
||||
#. module: golem_resource_pack
|
||||
#: model:ir.model.fields,field_description:golem_resource_pack.field_golem_pack_quick_reservation_wizard_create_date
|
||||
#: model:ir.model.fields,field_description:golem_resource_pack.field_golem_pack_rejection_wizard_create_date
|
||||
#: model:ir.model.fields,field_description:golem_resource_pack.field_golem_resource_pack_create_date
|
||||
msgid "Created on"
|
||||
msgstr ""
|
||||
|
||||
#. module: golem_resource_pack
|
||||
#: model:ir.model.fields,field_description:golem_resource_pack.field_golem_pack_quick_reservation_wizard_display_name
|
||||
#: model:ir.model.fields,field_description:golem_resource_pack.field_golem_pack_rejection_wizard_display_name
|
||||
#: model:ir.model.fields,field_description:golem_resource_pack.field_golem_resource_pack_display_name
|
||||
msgid "Display Name"
|
||||
@ -59,6 +68,11 @@ msgstr ""
|
||||
msgid "Draft"
|
||||
msgstr ""
|
||||
|
||||
#. module: golem_resource_pack
|
||||
#: model:ir.model,name:golem_resource_pack.model_golem_pack_quick_reservation_wizard
|
||||
msgid "GOLEM Pack Quick Reservation Wizard"
|
||||
msgstr ""
|
||||
|
||||
#. module: golem_resource_pack
|
||||
#: model:ir.model,name:golem_resource_pack.model_golem_resource_reservation
|
||||
msgid "GOLEM Reservation Model"
|
||||
@ -70,24 +84,28 @@ msgid "GOLEM Resource Pack Model"
|
||||
msgstr ""
|
||||
|
||||
#. module: golem_resource_pack
|
||||
#: model:ir.model.fields,field_description:golem_resource_pack.field_golem_pack_quick_reservation_wizard_id
|
||||
#: model:ir.model.fields,field_description:golem_resource_pack.field_golem_pack_rejection_wizard_id
|
||||
#: model:ir.model.fields,field_description:golem_resource_pack.field_golem_resource_pack_id
|
||||
msgid "ID"
|
||||
msgstr ""
|
||||
|
||||
#. module: golem_resource_pack
|
||||
#: model:ir.model.fields,field_description:golem_resource_pack.field_golem_pack_quick_reservation_wizard___last_update
|
||||
#: model:ir.model.fields,field_description:golem_resource_pack.field_golem_pack_rejection_wizard___last_update
|
||||
#: model:ir.model.fields,field_description:golem_resource_pack.field_golem_resource_pack___last_update
|
||||
msgid "Last Modified on"
|
||||
msgstr ""
|
||||
|
||||
#. module: golem_resource_pack
|
||||
#: model:ir.model.fields,field_description:golem_resource_pack.field_golem_pack_quick_reservation_wizard_write_uid
|
||||
#: model:ir.model.fields,field_description:golem_resource_pack.field_golem_pack_rejection_wizard_write_uid
|
||||
#: model:ir.model.fields,field_description:golem_resource_pack.field_golem_resource_pack_write_uid
|
||||
msgid "Last Updated by"
|
||||
msgstr ""
|
||||
|
||||
#. module: golem_resource_pack
|
||||
#: model:ir.model.fields,field_description:golem_resource_pack.field_golem_pack_quick_reservation_wizard_write_date
|
||||
#: model:ir.model.fields,field_description:golem_resource_pack.field_golem_pack_rejection_wizard_write_date
|
||||
#: model:ir.model.fields,field_description:golem_resource_pack.field_golem_resource_pack_write_date
|
||||
msgid "Last Updated on"
|
||||
@ -109,6 +127,7 @@ msgid "Notes, optional subject for the reservation, reason"
|
||||
msgstr ""
|
||||
|
||||
#. module: golem_resource_pack
|
||||
#: model:ir.model.fields,field_description:golem_resource_pack.field_golem_pack_quick_reservation_wizard_partner_id
|
||||
#: model:ir.model.fields,field_description:golem_resource_pack.field_golem_resource_pack_partner_id
|
||||
msgid "On behalf of"
|
||||
msgstr ""
|
||||
@ -119,22 +138,33 @@ msgid "Pack"
|
||||
msgstr ""
|
||||
|
||||
#. module: golem_resource_pack
|
||||
#: model:ir.model.fields,field_description:golem_resource_pack.field_golem_pack_quick_reservation_wizard_pack_id
|
||||
#: model:ir.model.fields,field_description:golem_resource_pack.field_golem_pack_rejection_wizard_pack_id
|
||||
msgid "Pack id"
|
||||
msgstr ""
|
||||
|
||||
#. module: golem_resource_pack
|
||||
#: code:addons/golem_resource_pack/models/golem_resource_pack.py:126
|
||||
#: code:addons/golem_resource_pack/models/golem_resource_pack.py:138
|
||||
#, python-format
|
||||
msgid "Pack partner should be the same for all reservations"
|
||||
msgstr ""
|
||||
|
||||
#. module: golem_resource_pack
|
||||
#: code:addons/golem_resource_pack/models/golem_resource_pack.py:108
|
||||
#: code:addons/golem_resource_pack/models/golem_resource_pack.py:120
|
||||
#, python-format
|
||||
msgid "Please enter the rejection reason"
|
||||
msgstr ""
|
||||
|
||||
#. module: golem_resource_pack
|
||||
#: model:ir.ui.view,arch_db:golem_resource_pack.golem_resource_pack_view_form
|
||||
msgid "Quick Reservation"
|
||||
msgstr ""
|
||||
|
||||
#. module: golem_resource_pack
|
||||
#: model:ir.ui.view,arch_db:golem_resource_pack.golem_pack_quick_reservation_wizard_view_form
|
||||
msgid "Quick Reservations"
|
||||
msgstr ""
|
||||
|
||||
#. module: golem_resource_pack
|
||||
#: model:ir.model.fields,field_description:golem_resource_pack.field_golem_pack_rejection_wizard_reason
|
||||
msgid "Reason"
|
||||
@ -178,16 +208,37 @@ msgstr ""
|
||||
msgid "Reservations"
|
||||
msgstr ""
|
||||
|
||||
#. module: golem_resource_pack
|
||||
#: code:addons/golem_resource_pack/models/golem_resource_pack.py:60
|
||||
#, python-format
|
||||
msgid "Reservations Creation"
|
||||
msgstr ""
|
||||
|
||||
#. module: golem_resource_pack
|
||||
#: model:ir.model.fields,field_description:golem_resource_pack.field_golem_pack_quick_reservation_wizard_resource_ids
|
||||
msgid "Resource List"
|
||||
msgstr ""
|
||||
|
||||
#. module: golem_resource_pack
|
||||
#: model:ir.ui.view,arch_db:golem_resource_pack.golem_resource_pack_view_form
|
||||
msgid "Set to draft"
|
||||
msgstr ""
|
||||
|
||||
#. module: golem_resource_pack
|
||||
#: model:ir.model.fields,field_description:golem_resource_pack.field_golem_pack_quick_reservation_wizard_date_start
|
||||
msgid "Start date"
|
||||
msgstr ""
|
||||
|
||||
#. module: golem_resource_pack
|
||||
#: model:ir.model.fields,field_description:golem_resource_pack.field_golem_resource_pack_state
|
||||
msgid "State"
|
||||
msgstr ""
|
||||
|
||||
#. module: golem_resource_pack
|
||||
#: model:ir.model.fields,field_description:golem_resource_pack.field_golem_pack_quick_reservation_wizard_date_stop
|
||||
msgid "Stop date"
|
||||
msgstr ""
|
||||
|
||||
#. module: golem_resource_pack
|
||||
#: model:ir.model.fields,field_description:golem_resource_pack.field_golem_resource_pack_user_id
|
||||
msgid "User"
|
||||
|
@ -52,6 +52,18 @@ class GolemResourcePack(models.Model):
|
||||
reservation_count = fields.Integer(compute='_compute_reservation_count')
|
||||
rejection_reason = fields.Text(readonly=True, track_visibility='onchange')
|
||||
|
||||
@api.multi
|
||||
def quick_reservation(self):
|
||||
""" Quick Reservation Creating"""
|
||||
self.ensure_one()
|
||||
pack_id = self[0]
|
||||
return {'name' : _('Reservations Creation'),
|
||||
'type' : 'ir.actions.act_window',
|
||||
'res_model' : 'golem.pack.quick.reservation.wizard',
|
||||
'context': {'default_pack_id': pack_id.id},
|
||||
'view_mode': 'form',
|
||||
'target': 'new'}
|
||||
|
||||
@api.depends('reservation_ids')
|
||||
def _compute_reservation_count(self):
|
||||
for pack in self:
|
||||
|
@ -61,8 +61,14 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
<field name="user_id" />
|
||||
<field name="partner_id" />
|
||||
<field name="note" />
|
||||
|
||||
<field name="rejection_reason"
|
||||
attrs="{'invisible': [('state', '!=', 'rejected')]}"/>
|
||||
|
||||
</group>
|
||||
<group>
|
||||
<button name="quick_reservation" type="object"
|
||||
string="Quick Reservation" states="draft" class="oe_highlight" />
|
||||
</group>
|
||||
<group colspan="2" name="reservations">
|
||||
<field name="reservation_ids" widget="many2many"
|
||||
|
@ -16,4 +16,4 @@
|
||||
# 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_pack_rejection
|
||||
from . import golem_pack_rejection, golem_pack_quick_reservation
|
||||
|
59
golem_resource_pack/wizard/golem_pack_quick_reservation.py
Normal file
59
golem_resource_pack/wizard/golem_pack_quick_reservation.py
Normal file
@ -0,0 +1,59 @@
|
||||
# -*- 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 Pack Quick Reservation Wizard """
|
||||
|
||||
from datetime import timedelta
|
||||
from odoo import models, fields, api
|
||||
|
||||
class GolemPackQuickReservationWizard(models.TransientModel):
|
||||
""" GOLEM Pack Quick Reservation Wizard """
|
||||
_name = 'golem.pack.quick.reservation.wizard'
|
||||
_description = 'GOLEM Pack Quick Reservation Wizard'
|
||||
|
||||
pack_id = fields.Many2one('golem.resource.pack', required=True,
|
||||
ondelete='cascade')
|
||||
partner_id = fields.Many2one(related='pack_id.partner_id')
|
||||
resource_ids = fields.Many2many('golem.resource', string="Resource List")
|
||||
|
||||
date_start = fields.Datetime('Start date', required=True)
|
||||
date_stop = fields.Datetime('Stop date', required=True)
|
||||
|
||||
@api.onchange('date_start')
|
||||
def onchange_date_start(self):
|
||||
""" Propose automatically stop hour after start hour had been filled """
|
||||
for reservation in self:
|
||||
if reservation.date_start:
|
||||
start = fields.Datetime.from_string(reservation.date_start)
|
||||
duration = timedelta(hours=1)
|
||||
reservation.date_stop = start + duration
|
||||
|
||||
@api.multi
|
||||
def create_reservations(self):
|
||||
""" Create a reservation for each resource """
|
||||
self.ensure_one()
|
||||
wizard = self[0]
|
||||
for resource in wizard.resource_ids:
|
||||
self.env['golem.resource.reservation'].create({
|
||||
'user_id': self.env.user.id,
|
||||
'partner_id': wizard.partner_id.id,
|
||||
'resource_id': resource.id,
|
||||
'date_start': wizard.date_start,
|
||||
'date_stop': wizard.date_stop,
|
||||
'pack_id': wizard.pack_id.id
|
||||
})
|
@ -0,0 +1,46 @@
|
||||
<?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>
|
||||
|
||||
<!-- Forms -->
|
||||
<record model="ir.ui.view" id="golem_pack_quick_reservation_wizard_view_form">
|
||||
<field name="name">GOLEM Pack Quick Reservation Wizard Form</field>
|
||||
<field name="model">golem.pack.quick.reservation.wizard</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Quick Reservations">
|
||||
<sheet>
|
||||
<group>
|
||||
<field name="pack_id" readonly="1" />
|
||||
<field name="partner_id" readonly="1"/>
|
||||
<field name="resource_ids" options="{'no_create': True}" />
|
||||
<field name="date_start" />
|
||||
<field name="date_stop" />
|
||||
</group>
|
||||
</sheet>
|
||||
<footer>
|
||||
<button name="create_reservations" string="Create Reservations"
|
||||
type="object" class="oe_highlight" />
|
||||
<button string="Cancel" class="oe_link" special="cancel" />
|
||||
</footer>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
</data>
|
||||
</odoo>
|
19
golem_resource_report/__init__.py
Normal file
19
golem_resource_report/__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 reports, wizard
|
35
golem_resource_report/__manifest__.py
Normal file
35
golem_resource_report/__manifest__.py
Normal file
@ -0,0 +1,35 @@
|
||||
# -*- 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 reports',
|
||||
'summary': 'GOLEM resources reports',
|
||||
'description': ''' GOLEM resources reports ''',
|
||||
'version': '10.0.0.1.1',
|
||||
'category': 'GOLEM',
|
||||
'author': 'Youssef El Ouahby, Fabien Bourgeois',
|
||||
'license': 'AGPL-3',
|
||||
'application': False,
|
||||
'installable': True,
|
||||
'depends': ['golem_resource'],
|
||||
'data': ['data/golem_resource_report_data.xml',
|
||||
'reports/golem_reservation_report.xml',
|
||||
'reports/golem_reservation_report_menu.xml',
|
||||
'wizard/golem_resource_report_wizard_views.xml',
|
||||
'views/golem_resource_report_menu.xml']
|
||||
}
|
40
golem_resource_report/data/golem_resource_report_data.xml
Normal file
40
golem_resource_report/data/golem_resource_report_data.xml
Normal file
@ -0,0 +1,40 @@
|
||||
<?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>
|
||||
|
||||
<record id="paperformat_euro_landscape"
|
||||
model="report.paperformat">
|
||||
<field name="name">European A4 Landscape</field>
|
||||
<field name="default" eval="True" />
|
||||
<field name="format">A4</field>
|
||||
<field name="page_height">0</field>
|
||||
<field name="page_width">0</field>
|
||||
<field name="orientation">Landscape</field>
|
||||
<field name="margin_top">10</field>
|
||||
<field name="margin_bottom">23</field>
|
||||
<field name="margin_left">7</field>
|
||||
<field name="margin_right">7</field>
|
||||
<field name="header_line" eval="False" />
|
||||
<field name="header_spacing">35</field>
|
||||
<field name="dpi">90</field>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</odoo>
|
152
golem_resource_report/i18n/fr.po
Normal file
152
golem_resource_report/i18n/fr.po
Normal file
@ -0,0 +1,152 @@
|
||||
# Translation of Odoo Server.
|
||||
# This file contains the translation of the following modules:
|
||||
# * golem_resource_report
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Odoo Server 10.0\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2018-05-25 16:13+0000\n"
|
||||
"PO-Revision-Date: 2018-05-25 16:13+0000\n"
|
||||
"Last-Translator: <>\n"
|
||||
"Language-Team: \n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: \n"
|
||||
"Plural-Forms: \n"
|
||||
|
||||
#. module: golem_resource_report
|
||||
#: model:ir.ui.view,arch_db:golem_resource_report.golem_reservation_report
|
||||
msgid "<br/>\n"
|
||||
" To"
|
||||
msgstr "<br/>\n"
|
||||
" À"
|
||||
|
||||
#. module: golem_resource_report
|
||||
#: model:ir.ui.view,arch_db:golem_resource_report.golem_reservation_report
|
||||
msgid "<strong>From Date: </strong>"
|
||||
msgstr "<strong>De : </strong>"
|
||||
|
||||
#. module: golem_resource_report
|
||||
#: model:ir.ui.view,arch_db:golem_resource_report.golem_reservation_report
|
||||
msgid "<strong>To Date:</strong>"
|
||||
msgstr "<strong>À :</strong>"
|
||||
|
||||
#. module: golem_resource_report
|
||||
#: model:ir.ui.view,arch_db:golem_resource_report.golem_resource_report_wizard_view_form
|
||||
msgid "Close"
|
||||
msgstr "Fermer"
|
||||
|
||||
#. module: golem_resource_report
|
||||
#: model:ir.model.fields,field_description:golem_resource_report.field_golem_resource_report_wizard_create_uid
|
||||
msgid "Created by"
|
||||
msgstr "Créé par"
|
||||
|
||||
#. module: golem_resource_report
|
||||
#: model:ir.model.fields,field_description:golem_resource_report.field_golem_resource_report_wizard_create_date
|
||||
msgid "Created on"
|
||||
msgstr "Créé le"
|
||||
|
||||
#. module: golem_resource_report
|
||||
#: model:ir.model.fields,field_description:golem_resource_report.field_golem_resource_report_wizard_date_start
|
||||
msgid "Date start"
|
||||
msgstr "Date de début"
|
||||
|
||||
#. module: golem_resource_report
|
||||
#: model:ir.model.fields,field_description:golem_resource_report.field_golem_resource_report_wizard_date_stop
|
||||
msgid "Date stop"
|
||||
msgstr "Date de fin"
|
||||
|
||||
#. module: golem_resource_report
|
||||
#: model:ir.model.fields,field_description:golem_resource_report.field_golem_resource_report_wizard_display_name
|
||||
#: model:ir.model.fields,field_description:golem_resource_report.field_report_golem_resource_report_golem_reservation_report_display_name
|
||||
msgid "Display Name"
|
||||
msgstr "Nom affiché"
|
||||
|
||||
#. module: golem_resource_report
|
||||
#: model:ir.ui.view,arch_db:golem_resource_report.golem_reservation_report
|
||||
msgid "For"
|
||||
msgstr "Pour"
|
||||
|
||||
#. module: golem_resource_report
|
||||
#: model:ir.ui.view,arch_db:golem_resource_report.golem_reservation_report
|
||||
msgid "From"
|
||||
msgstr "De"
|
||||
|
||||
#. module: golem_resource_report
|
||||
#: model:ir.model,name:golem_resource_report.model_report_golem_resource_report_golem_reservation_report
|
||||
msgid "Golem Reservation Report"
|
||||
msgstr "Golem Reservation Report"
|
||||
|
||||
#. module: golem_resource_report
|
||||
#: model:ir.model.fields,field_description:golem_resource_report.field_golem_resource_report_wizard_id
|
||||
#: model:ir.model.fields,field_description:golem_resource_report.field_report_golem_resource_report_golem_reservation_report_id
|
||||
msgid "ID"
|
||||
msgstr "ID"
|
||||
|
||||
#. module: golem_resource_report
|
||||
#: model:ir.model.fields,field_description:golem_resource_report.field_golem_resource_report_wizard___last_update
|
||||
#: model:ir.model.fields,field_description:golem_resource_report.field_report_golem_resource_report_golem_reservation_report___last_update
|
||||
msgid "Last Modified on"
|
||||
msgstr "Dernière Modification le"
|
||||
|
||||
#. module: golem_resource_report
|
||||
#: model:ir.model.fields,field_description:golem_resource_report.field_golem_resource_report_wizard_write_uid
|
||||
msgid "Last Updated by"
|
||||
msgstr "Dernière mise à jour par"
|
||||
|
||||
#. module: golem_resource_report
|
||||
#: model:ir.model.fields,field_description:golem_resource_report.field_golem_resource_report_wizard_write_date
|
||||
msgid "Last Updated on"
|
||||
msgstr "Dernière mise à jour le"
|
||||
|
||||
#. module: golem_resource_report
|
||||
#: model:ir.ui.view,arch_db:golem_resource_report.golem_resource_report_wizard_view_form
|
||||
msgid "Print Report"
|
||||
msgstr "Imprimer le rapport"
|
||||
|
||||
#. module: golem_resource_report
|
||||
#: model:ir.ui.menu,name:golem_resource_report.report_menu
|
||||
msgid "Report"
|
||||
msgstr "Rapport"
|
||||
|
||||
#. module: golem_resource_report
|
||||
#: model:ir.actions.report.xml,name:golem_resource_report.action_report_report_admission_analysis
|
||||
msgid "Reservations Report"
|
||||
msgstr "Export réservations"
|
||||
|
||||
#. module: golem_resource_report
|
||||
#: model:ir.ui.menu,name:golem_resource_report.reservation_resource_day_menu
|
||||
msgid "Reservations per resource and day"
|
||||
msgstr "Réservations par ressource et jour"
|
||||
|
||||
#. module: golem_resource_report
|
||||
#: model:ir.ui.view,arch_db:golem_resource_report.golem_resource_report_wizard_view_form
|
||||
msgid "Resource Report"
|
||||
msgstr "Ressource"
|
||||
|
||||
#. module: golem_resource_report
|
||||
#: model:ir.model.fields,field_description:golem_resource_report.field_golem_resource_report_wizard_resource_ids
|
||||
msgid "Resource ids"
|
||||
msgstr "Ressources"
|
||||
|
||||
#. module: golem_resource_report
|
||||
#: model:ir.actions.act_window,name:golem_resource_report.reservation_resource_day_action
|
||||
msgid "Resources Reports"
|
||||
msgstr "Ressources"
|
||||
|
||||
#. module: golem_resource_report
|
||||
#: code:addons/golem_resource_report/wizard/golem_resource_report_wizard.py:38
|
||||
#, python-format
|
||||
msgid "Stop Date cannot be set before Start Date."
|
||||
msgstr "La date de fin ne peut pas être antérieure à celle de début."
|
||||
|
||||
#. module: golem_resource_report
|
||||
#: model:ir.model,name:golem_resource_report.model_golem_resource_report_wizard
|
||||
msgid "golem.resource.report.wizard"
|
||||
msgstr "golem.resource.report.wizard"
|
||||
|
||||
#. module: golem_resource_report
|
||||
#: model:ir.ui.view,arch_db:golem_resource_report.golem_reservation_report
|
||||
msgid "reservations<br/>"
|
||||
msgstr "réservations<br/>"
|
152
golem_resource_report/i18n/golem_resource_report.pot
Normal file
152
golem_resource_report/i18n/golem_resource_report.pot
Normal file
@ -0,0 +1,152 @@
|
||||
# Translation of Odoo Server.
|
||||
# This file contains the translation of the following modules:
|
||||
# * golem_resource_report
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Odoo Server 10.0\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2018-05-25 16:13+0000\n"
|
||||
"PO-Revision-Date: 2018-05-25 16:13+0000\n"
|
||||
"Last-Translator: <>\n"
|
||||
"Language-Team: \n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: \n"
|
||||
"Plural-Forms: \n"
|
||||
|
||||
#. module: golem_resource_report
|
||||
#: model:ir.ui.view,arch_db:golem_resource_report.golem_reservation_report
|
||||
msgid "<br/>\n"
|
||||
" To"
|
||||
msgstr ""
|
||||
|
||||
#. module: golem_resource_report
|
||||
#: model:ir.ui.view,arch_db:golem_resource_report.golem_reservation_report
|
||||
msgid "<strong>From Date: </strong>"
|
||||
msgstr ""
|
||||
|
||||
#. module: golem_resource_report
|
||||
#: model:ir.ui.view,arch_db:golem_resource_report.golem_reservation_report
|
||||
msgid "<strong>To Date:</strong>"
|
||||
msgstr ""
|
||||
|
||||
#. module: golem_resource_report
|
||||
#: model:ir.ui.view,arch_db:golem_resource_report.golem_resource_report_wizard_view_form
|
||||
msgid "Close"
|
||||
msgstr ""
|
||||
|
||||
#. module: golem_resource_report
|
||||
#: model:ir.model.fields,field_description:golem_resource_report.field_golem_resource_report_wizard_create_uid
|
||||
msgid "Created by"
|
||||
msgstr ""
|
||||
|
||||
#. module: golem_resource_report
|
||||
#: model:ir.model.fields,field_description:golem_resource_report.field_golem_resource_report_wizard_create_date
|
||||
msgid "Created on"
|
||||
msgstr ""
|
||||
|
||||
#. module: golem_resource_report
|
||||
#: model:ir.model.fields,field_description:golem_resource_report.field_golem_resource_report_wizard_date_start
|
||||
msgid "Date start"
|
||||
msgstr ""
|
||||
|
||||
#. module: golem_resource_report
|
||||
#: model:ir.model.fields,field_description:golem_resource_report.field_golem_resource_report_wizard_date_stop
|
||||
msgid "Date stop"
|
||||
msgstr ""
|
||||
|
||||
#. module: golem_resource_report
|
||||
#: model:ir.model.fields,field_description:golem_resource_report.field_golem_resource_report_wizard_display_name
|
||||
#: model:ir.model.fields,field_description:golem_resource_report.field_report_golem_resource_report_golem_reservation_report_display_name
|
||||
msgid "Display Name"
|
||||
msgstr ""
|
||||
|
||||
#. module: golem_resource_report
|
||||
#: model:ir.ui.view,arch_db:golem_resource_report.golem_reservation_report
|
||||
msgid "For"
|
||||
msgstr ""
|
||||
|
||||
#. module: golem_resource_report
|
||||
#: model:ir.ui.view,arch_db:golem_resource_report.golem_reservation_report
|
||||
msgid "From"
|
||||
msgstr ""
|
||||
|
||||
#. module: golem_resource_report
|
||||
#: model:ir.model,name:golem_resource_report.model_report_golem_resource_report_golem_reservation_report
|
||||
msgid "Golem Reservation Report"
|
||||
msgstr ""
|
||||
|
||||
#. module: golem_resource_report
|
||||
#: model:ir.model.fields,field_description:golem_resource_report.field_golem_resource_report_wizard_id
|
||||
#: model:ir.model.fields,field_description:golem_resource_report.field_report_golem_resource_report_golem_reservation_report_id
|
||||
msgid "ID"
|
||||
msgstr ""
|
||||
|
||||
#. module: golem_resource_report
|
||||
#: model:ir.model.fields,field_description:golem_resource_report.field_golem_resource_report_wizard___last_update
|
||||
#: model:ir.model.fields,field_description:golem_resource_report.field_report_golem_resource_report_golem_reservation_report___last_update
|
||||
msgid "Last Modified on"
|
||||
msgstr ""
|
||||
|
||||
#. module: golem_resource_report
|
||||
#: model:ir.model.fields,field_description:golem_resource_report.field_golem_resource_report_wizard_write_uid
|
||||
msgid "Last Updated by"
|
||||
msgstr ""
|
||||
|
||||
#. module: golem_resource_report
|
||||
#: model:ir.model.fields,field_description:golem_resource_report.field_golem_resource_report_wizard_write_date
|
||||
msgid "Last Updated on"
|
||||
msgstr ""
|
||||
|
||||
#. module: golem_resource_report
|
||||
#: model:ir.ui.view,arch_db:golem_resource_report.golem_resource_report_wizard_view_form
|
||||
msgid "Print Report"
|
||||
msgstr ""
|
||||
|
||||
#. module: golem_resource_report
|
||||
#: model:ir.ui.menu,name:golem_resource_report.report_menu
|
||||
msgid "Report"
|
||||
msgstr ""
|
||||
|
||||
#. module: golem_resource_report
|
||||
#: model:ir.actions.report.xml,name:golem_resource_report.action_report_report_admission_analysis
|
||||
msgid "Reservations Report"
|
||||
msgstr ""
|
||||
|
||||
#. module: golem_resource_report
|
||||
#: model:ir.ui.menu,name:golem_resource_report.reservation_resource_day_menu
|
||||
msgid "Reservations per resource and day"
|
||||
msgstr ""
|
||||
|
||||
#. module: golem_resource_report
|
||||
#: model:ir.ui.view,arch_db:golem_resource_report.golem_resource_report_wizard_view_form
|
||||
msgid "Resource Report"
|
||||
msgstr ""
|
||||
|
||||
#. module: golem_resource_report
|
||||
#: model:ir.model.fields,field_description:golem_resource_report.field_golem_resource_report_wizard_resource_ids
|
||||
msgid "Resource ids"
|
||||
msgstr ""
|
||||
|
||||
#. module: golem_resource_report
|
||||
#: model:ir.actions.act_window,name:golem_resource_report.reservation_resource_day_action
|
||||
msgid "Resources Reports"
|
||||
msgstr ""
|
||||
|
||||
#. module: golem_resource_report
|
||||
#: code:addons/golem_resource_report/wizard/golem_resource_report_wizard.py:38
|
||||
#, python-format
|
||||
msgid "Stop Date cannot be set before Start Date."
|
||||
msgstr ""
|
||||
|
||||
#. module: golem_resource_report
|
||||
#: model:ir.model,name:golem_resource_report.model_golem_resource_report_wizard
|
||||
msgid "golem.resource.report.wizard"
|
||||
msgstr ""
|
||||
|
||||
#. module: golem_resource_report
|
||||
#: model:ir.ui.view,arch_db:golem_resource_report.golem_reservation_report
|
||||
msgid "reservations<br/>"
|
||||
msgstr ""
|
||||
|
19
golem_resource_report/reports/__init__.py
Normal file
19
golem_resource_report/reports/__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_reservation_report
|
108
golem_resource_report/reports/golem_reservation_report.py
Normal file
108
golem_resource_report/reports/golem_reservation_report.py
Normal file
@ -0,0 +1,108 @@
|
||||
# -*- 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 Reservation Report """
|
||||
|
||||
import time
|
||||
from random import randint
|
||||
from odoo import models, fields, api
|
||||
|
||||
# FIXME: usage of Odoo fields will be needed for i18n awareness
|
||||
|
||||
def get_client_color(partner_number):
|
||||
""" Get Client Color """
|
||||
colors = ['#FFFF5B', '#81EC54', '#47C8C8', '#FB5A66', '#E8E750',
|
||||
'#CF4ACF', '#9655D2', '#FFA15B', '#5F68D5', '#60E652']
|
||||
color = "#000000"
|
||||
if partner_number < 10:
|
||||
color = colors[partner_number]
|
||||
else:
|
||||
red = randint(128, 255)
|
||||
green = randint(128, 255)
|
||||
blue = randint(128, 255)
|
||||
color = "#" +hex(red)[2:]+hex(green)[2:]+hex(blue)[2:]
|
||||
return color
|
||||
|
||||
|
||||
class GolemResevationReport(models.AbstractModel):
|
||||
""" Golem Reservation Report """
|
||||
_name = 'report.golem_resource_report.golem_reservation_report'
|
||||
_description = 'Golem Reservation Report'
|
||||
|
||||
def get_data(self, data):
|
||||
""" Get Resevation Data """
|
||||
domain = [('state', '=', 'validated'),
|
||||
('date_start', '>', data['date_start']),
|
||||
('date_stop', '<', data['date_stop']),
|
||||
('resource_id', 'in', data['resource_ids'])]
|
||||
reservations = self.env['golem.resource.reservation'].search(domain, order='date_start')
|
||||
total_reservations = len(reservations)
|
||||
resources = {r.resource_id.id: r.resource_id.name for r in reservations}
|
||||
days = sorted(list(set(reservations.mapped('day_start'))))
|
||||
|
||||
partner_ids = reservations.mapped('partner_id.id')
|
||||
partner_colors = {}
|
||||
partner_number = 0
|
||||
for partner_id in partner_ids:
|
||||
partner_colors[str(partner_id)] = get_client_color(partner_number)
|
||||
partner_number += 1
|
||||
|
||||
res = {} # List of multi-levels : group by resource, then, day_start
|
||||
for reservation in reservations:
|
||||
resource = reservation.resource_id.id
|
||||
day_start = reservation.day_start
|
||||
if not resource in res:
|
||||
res[resource] = {}
|
||||
if not day_start in res[resource]:
|
||||
res[resource][day_start] = []
|
||||
line = {
|
||||
'name': reservation.name,
|
||||
'resource_name': reservation.resource_id.name,
|
||||
'partner': reservation.partner_id.name,
|
||||
'date_start': reservation.date_start,
|
||||
'date_stop': reservation.date_stop,
|
||||
'day_start': reservation.day_start,
|
||||
'day_stop': fields.Datetime.from_string(reservation.date_stop).strftime('%Y-%m-%d'),
|
||||
'bgcolor': partner_colors[str(reservation.partner_id.id)],
|
||||
'note': reservation.note
|
||||
}
|
||||
res[resource][day_start].append(line)
|
||||
return res, total_reservations, resources, days
|
||||
|
||||
@api.model
|
||||
def render_html(self, docids, data=None):
|
||||
""" Render HTML """
|
||||
model = self.env.context.get('active_model')
|
||||
docs = self.env[model].browse(self.env.context.get('active_id'))
|
||||
_data, total_reservations, resources, days = self.get_data(data)
|
||||
docargs = {
|
||||
'doc_ids': self.ids,
|
||||
'doc_model': model,
|
||||
'docs': docs,
|
||||
'company': self.env.ref('base.main_company'),
|
||||
'time': time,
|
||||
'data': data,
|
||||
'date_start': '%s 00:00:00' % data['date_start'],
|
||||
'date_stop': '%s 23:59:59' % data['date_stop'],
|
||||
'total_reservations': total_reservations,
|
||||
'datas': _data,
|
||||
'resources': resources,
|
||||
'days': days
|
||||
}
|
||||
return self.env['report'] \
|
||||
.render('golem_resource_report.golem_reservation_report', docargs)
|
80
golem_resource_report/reports/golem_reservation_report.xml
Normal file
80
golem_resource_report/reports/golem_reservation_report.xml
Normal file
@ -0,0 +1,80 @@
|
||||
<?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>
|
||||
|
||||
<template id="golem_reservation_report">
|
||||
<t t-call="report.html_container">
|
||||
<t t-call="report.external_layout">
|
||||
<div class="font">
|
||||
<div class="page">
|
||||
<h3 class="text-center">
|
||||
<span t-esc="company.name" /> : <span t-esc="total_reservations" /> reservations<br />
|
||||
<small>
|
||||
<strong>From Date: </strong>
|
||||
<span t-esc="time.strftime('%d/%m/%Y',time.strptime(date_start,'%Y-%m-%d %H:%M:%S'))"/>
|
||||
<strong>To Date:</strong>
|
||||
<span t-esc="time.strftime('%d/%m/%Y',time.strptime(date_stop,'%Y-%m-%d %H:%M:%S'))"/>
|
||||
</small>
|
||||
</h3>
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th></th>
|
||||
<t t-foreach="days" t-as="day">
|
||||
<th class="text-center" t-esc="time.strftime('%A %d/%m',time.strptime(day,'%Y-%m-%d'))"/>
|
||||
</t>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr t-foreach="resources" t-as="resource_id">
|
||||
<td><span t-esc="resources[resource_id]" /></td>
|
||||
<t t-foreach="days" t-as="day">
|
||||
<td>
|
||||
<t t-if="datas.get(resource_id, {}).get(day)">
|
||||
<t t-set="reservations" t-value="datas[resource_id][day]" />
|
||||
<t t-foreach="reservations" t-as="resa">
|
||||
<div t-attf-style="background-color:{{resa['bgcolor']}}!important;border-top: 1px solid #333333;">
|
||||
<t t-if="resa['day_start']==resa['day_stop']">
|
||||
<span t-esc="time.strftime('%Hh%M',time.strptime(resa['date_start'],'%Y-%m-%d %H:%M:%S'))"/> -
|
||||
<span t-esc="time.strftime('%Hh%M',time.strptime(resa['date_stop'],'%Y-%m-%d %H:%M:%S'))"/>
|
||||
</t>
|
||||
<t t-else="">
|
||||
From <span t-esc="time.strftime('%d/%m %Hh%M',time.strptime(resa['date_start'],'%Y-%m-%d %H:%M:%S'))"/><br />
|
||||
To <span t-esc="time.strftime('%d/%m %Hh%M',time.strptime(resa['date_stop'],'%Y-%m-%d %H:%M:%S'))"/>
|
||||
</t>
|
||||
<p t-if="resa.get('note')" t-esc="resa['note']" />
|
||||
<br />
|
||||
<em>For <span t-esc="resa['partner']"/></em>
|
||||
</div>
|
||||
</t>
|
||||
</t>
|
||||
</td>
|
||||
</t>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</t>
|
||||
</t>
|
||||
</template>
|
||||
|
||||
</data>
|
||||
</odoo>
|
@ -0,0 +1,32 @@
|
||||
<?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>
|
||||
|
||||
<report id="action_report_report_admission_analysis"
|
||||
model="golem.resource.report.wizard"
|
||||
string="Reservations Report"
|
||||
report_type="qweb-pdf"
|
||||
name="golem_resource_report.golem_reservation_report"
|
||||
file="golem_resource_report.golem_reservation_report"
|
||||
menu="False" auto="False"
|
||||
paperformat="paperformat_euro_landscape" />
|
||||
|
||||
</data>
|
||||
</odoo>
|
41
golem_resource_report/views/golem_resource_report_menu.xml
Normal file
41
golem_resource_report/views/golem_resource_report_menu.xml
Normal file
@ -0,0 +1,41 @@
|
||||
<?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>
|
||||
|
||||
<!-- Actions -->
|
||||
<record model="ir.actions.act_window" id="reservation_resource_day_action">
|
||||
<field name="name">Resources Reports</field>
|
||||
<field name="res_model">golem.resource.report.wizard</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="view_id" ref="golem_resource_report_wizard_view_form" />
|
||||
<field name="context">{}</field>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
|
||||
<!-- Menus -->
|
||||
<menuitem id="report_menu" name="Report"
|
||||
parent="golem_resource.golem_resource_menu" sequence="80" />
|
||||
<menuitem id="reservation_resource_day_menu"
|
||||
name="Reservations per resource and day" parent="report_menu"
|
||||
action="reservation_resource_day_action" sequence="10" />
|
||||
|
||||
</data>
|
||||
</odoo>
|
19
golem_resource_report/wizard/__init__.py
Normal file
19
golem_resource_report/wizard/__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_report_wizard
|
44
golem_resource_report/wizard/golem_resource_report_wizard.py
Normal file
44
golem_resource_report/wizard/golem_resource_report_wizard.py
Normal file
@ -0,0 +1,44 @@
|
||||
# -*- 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 Resources Report Wizard """
|
||||
|
||||
from odoo import models, fields, api, _
|
||||
from odoo.exceptions import ValidationError
|
||||
|
||||
class GolemResourceReportWizard(models.TransientModel):
|
||||
"""GOLEM Report Wizard : Choose report parameters """
|
||||
_name = "golem.resource.report.wizard"
|
||||
|
||||
resource_ids = fields.Many2many('golem.resource', required=True)
|
||||
date_start = fields.Date(required=True)
|
||||
date_stop = fields.Date(required=True)
|
||||
|
||||
@api.multi
|
||||
def print_resource_report(self):
|
||||
""" Print Report """
|
||||
self.ensure_one()
|
||||
record = self[0]
|
||||
if record.date_start > record.date_stop:
|
||||
raise ValidationError(_('Stop Date cannot be set before Start Date.'))
|
||||
else:
|
||||
data = self.read(
|
||||
['resource_ids', 'date_start', 'date_stop'])[0]
|
||||
return self.env['report'].get_action(
|
||||
self, 'golem_resource_report.golem_reservation_report',
|
||||
data=data)
|
@ -0,0 +1,51 @@
|
||||
<?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>
|
||||
|
||||
<!-- Forms -->
|
||||
<record model="ir.ui.view" id="golem_resource_report_wizard_view_form">
|
||||
<field name="name">GOLEM resource Report Wizard Form</field>
|
||||
<field name="model">golem.resource.report.wizard</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Resource Report">
|
||||
<group>
|
||||
<group>
|
||||
<field name="resource_ids" options="{'no_create' : True}">
|
||||
<tree>
|
||||
<field name="name"/>
|
||||
</tree>
|
||||
</field>
|
||||
</group>
|
||||
<group>
|
||||
<field name="date_start" />
|
||||
<field name="date_stop" />
|
||||
</group>
|
||||
</group>
|
||||
<footer>
|
||||
<button name="print_resource_report" string="Print Report"
|
||||
type="object" class="oe_highlight" />
|
||||
<button string="Close" class="oe_link" special="cancel" />
|
||||
</footer>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</odoo>
|
Loading…
Reference in New Issue
Block a user