diff --git a/golem_resource/__manifest__.py b/golem_resource/__manifest__.py index 7d2daa2..25a50fc 100644 --- a/golem_resource/__manifest__.py +++ b/golem_resource/__manifest__.py @@ -20,7 +20,7 @@ 'name': 'GOLEM non-profit resources', 'summary': 'GOLEM resources management', 'description': ''' GOLEM resources management ''', - 'version': '10.0.1.13.1', + 'version': '10.0.1.13.2', 'category': 'GOLEM', 'author': 'Youssef El Ouahby, Fabien Bourgeois', 'license': 'AGPL-3', @@ -32,5 +32,6 @@ 'views/golem_resource_reservation_views.xml', 'views/golem_resource_timetable_views.xml', 'wizard/golem_reservation_rejection_views.xml', - 'security/ir.model.access.csv'] + 'security/ir.model.access.csv', + 'views/product_template_views.xml'] } diff --git a/golem_resource/i18n/fr.po b/golem_resource/i18n/fr.po index ddc67ef..0e6090b 100644 --- a/golem_resource/i18n/fr.po +++ b/golem_resource/i18n/fr.po @@ -6,8 +6,8 @@ msgid "" msgstr "" "Project-Id-Version: Odoo Server 10.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2018-03-26 15:36+0000\n" -"PO-Revision-Date: 2018-03-26 15:36+0000\n" +"POT-Creation-Date: 2018-04-16 14:29+0000\n" +"PO-Revision-Date: 2018-04-16 14:29+0000\n" "Last-Translator: <>\n" "Language-Team: \n" "MIME-Version: 1.0\n" @@ -21,6 +21,16 @@ msgstr "" msgid "24/7 availibility" msgstr "Disponibilité 24h/24 7j/7" +#. module: golem_resource +#: model:ir.ui.view,arch_db:golem_resource.golem_resource_reservation_view_search +msgid "30 Days Reservations" +msgstr "Dans les 30 jours" + +#. module: golem_resource +#: model:ir.ui.view,arch_db:golem_resource.golem_resource_reservation_view_search +msgid "7 Days Reservations" +msgstr "Dans les 7 jours" + #. module: golem_resource #: model:ir.model.fields,help:golem_resource.field_golem_resource_product_tmpl_id msgid "A generic product can be linked, in order to sell reservations (work in progress)" @@ -123,6 +133,11 @@ msgstr "Créé le" msgid "Day" msgstr "Jour" +#. module: golem_resource +#: model:ir.ui.view,arch_db:golem_resource.golem_resource_reservation_view_search +msgid "Day Reservation" +msgstr "Démarre ce jour" + #. module: golem_resource #: model:ir.model.fields,field_description:golem_resource.field_golem_resource_reservation_day_start msgid "Day start" @@ -228,6 +243,11 @@ msgstr "Dernière mise à jour par" msgid "Last Updated on" msgstr "Dernière mise à jour le" +#. module: golem_resource +#: model:ir.ui.view,arch_db:golem_resource.product_template_search_inherit_resource_view +msgid "Linked To A Resource" +msgstr "Lié à une ressource" + #. module: golem_resource #: model:ir.model.fields,field_description:golem_resource.field_golem_resource_product_tmpl_id #: model:ir.ui.view,arch_db:golem_resource.golem_resource_view_search @@ -313,6 +333,16 @@ msgstr "Merci de saisir le motif du refus" msgid "Please save the resource before fixing the timetable availibility\"" msgstr "Merci de sauvegarder la ressource avant de pouvoir définir ses disponibilités\"" +#. module: golem_resource +#: model:ir.model,name:golem_resource.model_product_template +msgid "Product Template" +msgstr "Modèle d'article" + +#. module: golem_resource +#: model:ir.actions.act_window,name:golem_resource.golem_resource_product_action +msgid "Products" +msgstr "Articles" + #. module: golem_resource #: model:ir.model.fields,field_description:golem_resource.field_golem_reservation_rejection_wizard_reason msgid "Reason" @@ -322,19 +352,19 @@ msgstr "Motif" #: model:ir.ui.view,arch_db:golem_resource.golem_reservation_rejection_wizard_view_form #: model:ir.ui.view,arch_db:golem_resource.golem_resource_reservation_view_form msgid "Reject" -msgstr "Rejet" +msgstr "Refus" #. module: golem_resource #: selection:golem.resource.reservation,state:0 #: model:ir.ui.view,arch_db:golem_resource.golem_resource_reservation_view_search msgid "Rejected" -msgstr "Rejeté" +msgstr "Refusé" #. module: golem_resource #: model:ir.model.fields,field_description:golem_resource.field_golem_resource_reservation_rejection_reason #: model:ir.ui.view,arch_db:golem_resource.golem_reservation_rejection_wizard_view_form msgid "Rejection reason" -msgstr "Motif du rejet" +msgstr "Motif du refus" #. module: golem_resource #: model:ir.ui.view,arch_db:golem_resource.golem_resource_reservation_view_form @@ -366,6 +396,11 @@ msgstr "Réservations" msgid "Resource" msgstr "Ressource" +#. module: golem_resource +#: model:ir.ui.menu,name:golem_resource.product_template_menu +msgid "Resource Products" +msgstr "Articles liés à des ressources" + #. module: golem_resource #: code:addons/golem_resource/models/golem_resource.py:64 #, python-format @@ -379,7 +414,7 @@ msgid "Resource Reservation list" msgstr "Liste des réservations" #. module: golem_resource -#: model:ir.model.fields,field_description:golem_resource.field_golem_resource_type_id_4449 +#: model:ir.model.fields,field_description:golem_resource.field_golem_resource_type_id_4023 #: model:ir.model.fields,field_description:golem_resource.field_golem_resource_type_name msgid "Resource Type" msgstr "Type de ressource" @@ -390,6 +425,12 @@ msgstr "Type de ressource" msgid "Resource Types" msgstr "Types de ressource" +#. module: golem_resource +#: model:ir.model.fields,field_description:golem_resource.field_product_product_resource_ids +#: model:ir.model.fields,field_description:golem_resource.field_product_template_resource_ids +msgid "Resource ids" +msgstr "Ressources" + #. module: golem_resource #: sql_constraint:golem.resource.type:0 msgid "Resource type must be unique." @@ -409,11 +450,6 @@ msgstr "Ressources" msgid "Saturday" msgstr "Samedi" -#. module: golem_resource -#: model:ir.ui.menu,name:golem_resource.product_template_menu -msgid "Sellable Products" -msgstr "Articles en vente" - #. module: golem_resource #: model:ir.ui.view,arch_db:golem_resource.golem_resource_reservation_view_form msgid "Set to draft" @@ -541,7 +577,7 @@ msgstr "Sans validation" #: code:addons/golem_resource/models/golem_resource_reservation.py:148 #, python-format msgid "You do not have permissions to validate or reject a reservation." -msgstr "Vous n'avez pas les autorisations nécessaires pour valider ou rejeter une réservation." +msgstr "Vous n'avez pas les autorisations nécessaires pour valider ou refuser une réservation." #. module: golem_resource #: model:ir.model,name:golem_resource.model_golem_reservation_rejection_wizard diff --git a/golem_resource/i18n/golem_resource.pot b/golem_resource/i18n/golem_resource.pot index 80852e2..5b1522f 100644 --- a/golem_resource/i18n/golem_resource.pot +++ b/golem_resource/i18n/golem_resource.pot @@ -6,8 +6,8 @@ msgid "" msgstr "" "Project-Id-Version: Odoo Server 10.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2018-03-26 15:37+0000\n" -"PO-Revision-Date: 2018-03-26 15:37+0000\n" +"POT-Creation-Date: 2018-04-16 14:29+0000\n" +"PO-Revision-Date: 2018-04-16 14:29+0000\n" "Last-Translator: <>\n" "Language-Team: \n" "MIME-Version: 1.0\n" @@ -21,6 +21,16 @@ msgstr "" msgid "24/7 availibility" msgstr "" +#. module: golem_resource +#: model:ir.ui.view,arch_db:golem_resource.golem_resource_reservation_view_search +msgid "30 Days Reservations" +msgstr "" + +#. module: golem_resource +#: model:ir.ui.view,arch_db:golem_resource.golem_resource_reservation_view_search +msgid "7 Days Reservations" +msgstr "" + #. module: golem_resource #: model:ir.model.fields,help:golem_resource.field_golem_resource_product_tmpl_id msgid "A generic product can be linked, in order to sell reservations (work in progress)" @@ -123,6 +133,11 @@ msgstr "" msgid "Day" msgstr "" +#. module: golem_resource +#: model:ir.ui.view,arch_db:golem_resource.golem_resource_reservation_view_search +msgid "Day Reservation" +msgstr "" + #. module: golem_resource #: model:ir.model.fields,field_description:golem_resource.field_golem_resource_reservation_day_start msgid "Day start" @@ -228,6 +243,11 @@ msgstr "" msgid "Last Updated on" msgstr "" +#. module: golem_resource +#: model:ir.ui.view,arch_db:golem_resource.product_template_search_inherit_resource_view +msgid "Linked To A Resource" +msgstr "" + #. module: golem_resource #: model:ir.model.fields,field_description:golem_resource.field_golem_resource_product_tmpl_id #: model:ir.ui.view,arch_db:golem_resource.golem_resource_view_search @@ -313,6 +333,16 @@ msgstr "" msgid "Please save the resource before fixing the timetable availibility\"" msgstr "" +#. module: golem_resource +#: model:ir.model,name:golem_resource.model_product_template +msgid "Product Template" +msgstr "" + +#. module: golem_resource +#: model:ir.actions.act_window,name:golem_resource.golem_resource_product_action +msgid "Products" +msgstr "" + #. module: golem_resource #: model:ir.model.fields,field_description:golem_resource.field_golem_reservation_rejection_wizard_reason msgid "Reason" @@ -366,6 +396,11 @@ msgstr "" msgid "Resource" msgstr "" +#. module: golem_resource +#: model:ir.ui.menu,name:golem_resource.product_template_menu +msgid "Resource Products" +msgstr "" + #. module: golem_resource #: code:addons/golem_resource/models/golem_resource.py:64 #, python-format @@ -379,7 +414,7 @@ msgid "Resource Reservation list" msgstr "" #. module: golem_resource -#: model:ir.model.fields,field_description:golem_resource.field_golem_resource_type_id_4449 +#: model:ir.model.fields,field_description:golem_resource.field_golem_resource_type_id_4023 #: model:ir.model.fields,field_description:golem_resource.field_golem_resource_type_name msgid "Resource Type" msgstr "" @@ -390,6 +425,12 @@ msgstr "" msgid "Resource Types" msgstr "" +#. module: golem_resource +#: model:ir.model.fields,field_description:golem_resource.field_product_product_resource_ids +#: model:ir.model.fields,field_description:golem_resource.field_product_template_resource_ids +msgid "Resource ids" +msgstr "" + #. module: golem_resource #: sql_constraint:golem.resource.type:0 msgid "Resource type must be unique." @@ -409,11 +450,6 @@ msgstr "" msgid "Saturday" msgstr "" -#. module: golem_resource -#: model:ir.ui.menu,name:golem_resource.product_template_menu -msgid "Sellable Products" -msgstr "" - #. module: golem_resource #: model:ir.ui.view,arch_db:golem_resource.golem_resource_reservation_view_form msgid "Set to draft" diff --git a/golem_resource/models/__init__.py b/golem_resource/models/__init__.py index d3aab06..af90c20 100644 --- a/golem_resource/models/__init__.py +++ b/golem_resource/models/__init__.py @@ -19,4 +19,5 @@ from . import golem_resource_type, \ golem_resource_timetable, \ golem_resource, \ - golem_resource_reservation + golem_resource_reservation, \ + product_template diff --git a/golem_resource/models/product_template.py b/golem_resource/models/product_template.py new file mode 100644 index 0000000..641acb2 --- /dev/null +++ b/golem_resource/models/product_template.py @@ -0,0 +1,27 @@ +# -*- coding: utf-8 -*- + +# Copyright 2018 Youssef El Ouahby +# Copyright 2018 Fabien Bourgeois +# +# 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 . + +""" Product Template """ + +from odoo import models, fields + +class ProductTemplate(models.Model): + """ Product Template Resource Adaptation """ + _inherit = "product.template" + + resource_ids = fields.One2many('golem.resource', 'product_tmpl_id') diff --git a/golem_resource/views/golem_resource_views.xml b/golem_resource/views/golem_resource_views.xml index 9120e28..7fb2a25 100644 --- a/golem_resource/views/golem_resource_views.xml +++ b/golem_resource/views/golem_resource_views.xml @@ -135,9 +135,6 @@ along with this program. If not, see . - diff --git a/golem_resource/views/product_template_views.xml b/golem_resource/views/product_template_views.xml new file mode 100644 index 0000000..65a10ee --- /dev/null +++ b/golem_resource/views/product_template_views.xml @@ -0,0 +1,45 @@ + + + + + + + + product.template.inherit.resource.search + product.template + + + + + + + + + + + + + + + + diff --git a/golem_resource_account/__manifest__.py b/golem_resource_account/__manifest__.py index fb647c3..3560e1b 100644 --- a/golem_resource_account/__manifest__.py +++ b/golem_resource_account/__manifest__.py @@ -20,7 +20,7 @@ 'name': 'GOLEM resources invoicing', 'summary': 'GOLEM resources invoicing', 'description': ''' GOLEM resources invoicing ''', - 'version': '10.0.0.1.3', + 'version': '10.0.0.2.0', 'category': 'GOLEM', 'author': 'Youssef El Ouahby, Fabien Bourgeois', 'license': 'AGPL-3', @@ -28,5 +28,6 @@ 'installable': True, 'depends': ['golem_resource', 'account'], 'data': ['wizard/golem_reservation_invoice_views.xml', - 'views/golem_resource_reservation_views.xml'] + 'views/golem_resource_reservation_views.xml', + 'wizard/golem_reservation_add_to_invoice_views.xml'] } diff --git a/golem_resource_account/i18n/fr.po b/golem_resource_account/i18n/fr.po index 7ab3f0b..2857f95 100644 --- a/golem_resource_account/i18n/fr.po +++ b/golem_resource_account/i18n/fr.po @@ -6,8 +6,8 @@ msgid "" msgstr "" "Project-Id-Version: Odoo Server 10.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2018-03-27 09:41+0000\n" -"PO-Revision-Date: 2018-03-27 09:41+0000\n" +"POT-Creation-Date: 2018-04-16 16:11+0000\n" +"PO-Revision-Date: 2018-04-16 16:11+0000\n" "Last-Translator: <>\n" "Language-Team: \n" "MIME-Version: 1.0\n" @@ -44,6 +44,11 @@ msgstr "\n" msgid "A generic product can be linked, in order to sell reservations (work in progress)" msgstr "Un article générique peut être lié, dans l'objectif de monétiser des réservations (à venir)" +#. module: golem_resource_account +#: model:ir.ui.view,arch_db:golem_resource_account.golem_resource_reservation_form_inherit_golem_resource_account +msgid "Add To Invoice" +msgstr "Ajouter à une facture" + #. module: golem_resource_account #: model:ir.model.fields,field_description:golem_resource_account.field_golem_resource_reservation_invoice_line_price_subtotal msgid "Amount" @@ -54,6 +59,11 @@ msgstr "Montant" msgid "Cancel" msgstr "Annuler" +#. module: golem_resource_account +#: model:ir.ui.view,arch_db:golem_resource_account.golem_reservation_add_to_invoice_form +msgid "Close" +msgstr "Fermer" + #. module: golem_resource_account #: model:ir.ui.view,arch_db:golem_resource_account.golem_resource_reservation_form_inherit_golem_resource_account msgid "Create Invoice" @@ -70,11 +80,13 @@ msgid "Create invoice and Close" msgstr "Créer la facture et fermer" #. module: golem_resource_account +#: model:ir.model.fields,field_description:golem_resource_account.field_golem_reservation_add_to_invoice_wizard_create_uid #: model:ir.model.fields,field_description:golem_resource_account.field_golem_reservation_invoice_wizard_create_uid msgid "Created by" msgstr "Créé par" #. module: golem_resource_account +#: model:ir.model.fields,field_description:golem_resource_account.field_golem_reservation_add_to_invoice_wizard_create_date #: model:ir.model.fields,field_description:golem_resource_account.field_golem_reservation_invoice_wizard_create_date msgid "Created on" msgstr "Créé le" @@ -85,6 +97,7 @@ msgid "Currency" msgstr "Devise" #. module: golem_resource_account +#: model:ir.model.fields,field_description:golem_resource_account.field_golem_reservation_add_to_invoice_wizard_display_name #: model:ir.model.fields,field_description:golem_resource_account.field_golem_reservation_invoice_wizard_display_name msgid "Display Name" msgstr "Nom affiché" @@ -95,11 +108,13 @@ msgid "GOLEM Reservation Model" msgstr "GOLEM Reservation Model" #. module: golem_resource_account +#: model:ir.model.fields,field_description:golem_resource_account.field_golem_reservation_add_to_invoice_wizard_id #: model:ir.model.fields,field_description:golem_resource_account.field_golem_reservation_invoice_wizard_id msgid "ID" msgstr "ID" #. module: golem_resource_account +#: model:ir.model,name:golem_resource_account.model_account_invoice #: model:ir.model.fields,field_description:golem_resource_account.field_golem_resource_reservation_invoice_id #: model:ir.ui.view,arch_db:golem_resource_account.golem_resource_reservation_search_inherit_golem_resource_account msgid "Invoice" @@ -131,16 +146,19 @@ msgid "Invoicing" msgstr "Facturation" #. module: golem_resource_account +#: model:ir.model.fields,field_description:golem_resource_account.field_golem_reservation_add_to_invoice_wizard___last_update #: model:ir.model.fields,field_description:golem_resource_account.field_golem_reservation_invoice_wizard___last_update msgid "Last Modified on" msgstr "Dernière Modification le" #. module: golem_resource_account +#: model:ir.model.fields,field_description:golem_resource_account.field_golem_reservation_add_to_invoice_wizard_write_uid #: model:ir.model.fields,field_description:golem_resource_account.field_golem_reservation_invoice_wizard_write_uid msgid "Last Updated by" msgstr "Dernière mise à jour par" #. module: golem_resource_account +#: model:ir.model.fields,field_description:golem_resource_account.field_golem_reservation_add_to_invoice_wizard_write_date #: model:ir.model.fields,field_description:golem_resource_account.field_golem_reservation_invoice_wizard_write_date msgid "Last Updated on" msgstr "Dernière mise à jour le" @@ -150,11 +168,33 @@ msgstr "Dernière mise à jour le" msgid "Linked product" msgstr "Article lié" +#. module: golem_resource_account +#: code:addons/golem_resource_account/models/account_invoice.py:41 +#, python-format +msgid "No reservation has been found with {} reservation ID. Please contact your administrator." +msgstr "No reservation has been found with {} reservation ID. Please contact your administrator." + #. module: golem_resource_account #: model:ir.ui.view,arch_db:golem_resource_account.golem_resource_reservation_search_inherit_golem_resource_account msgid "Not invoiced" msgstr "Non facturé" +#. module: golem_resource_account +#: model:ir.model.fields,field_description:golem_resource_account.field_golem_reservation_add_to_invoice_wizard_invoice_ids +msgid "Partner invoice list" +msgstr "Liste des factures du contact" + +#. module: golem_resource_account +#: code:addons/golem_resource_account/models/golem_resource_reservation.py:130 +#, python-format +msgid "Partner's invoice list" +msgstr "Partner's invoice list" + +#. module: golem_resource_account +#: model:ir.model.fields,field_description:golem_resource_account.field_golem_reservation_add_to_invoice_wizard_reservation_id +msgid "Reservation id" +msgstr "Reservation id" + #. module: golem_resource_account #: model:ir.actions.act_window,name:golem_resource_account.action_golem_reservation_invoice_wizard #: model:ir.model.fields,field_description:golem_resource_account.field_golem_reservation_invoice_wizard_reservation_ids @@ -178,12 +218,24 @@ msgstr "État" msgid "The reservation \"{}\" is not validated, please validate it before creating invoice" msgstr "La réservation \"{}\" n'est pas validée, merci de la valider avant de créer une facture" +#. module: golem_resource_account +#: code:addons/golem_resource_account/models/golem_resource_reservation.py:139 +#, python-format +msgid "There is no existing invoice for the current client, please create new one to invoice this reservation" +msgstr "Il n'y a pas de facture existante pour le contact actuel. Merci de créer une nouvelle facture pour cette réservation" + #. module: golem_resource_account #: code:addons/golem_resource_account/models/golem_resource_reservation.py:66 #, python-format msgid "There is no income account defined for this product: \"{}\". You have to configure it on the product form." msgstr "Il n'y a pas de compte de revenus défini pour cet article: \"{}\". Vous devez en configurer un sur la fiche article." +#. module: golem_resource_account +#: code:addons/golem_resource_account/models/account_invoice.py:35 +#, python-format +msgid "There is no reservation passed through context. Please contact your administrator." +msgstr "Il n'y a pas de réservation qui ait été passée par le contexte. Merci de contacter votre administrateur." + #. module: golem_resource_account #: model:ir.model.fields,field_description:golem_resource_account.field_golem_resource_reservation_invoice_amount_total msgid "Total" @@ -207,6 +259,11 @@ msgstr "Vous ne pouvez pas créer de facture sans article liée à la ressource msgid "You can't group reservations of multiple clients in the same invoice, please remove inadequate reservations" msgstr "Vous ne pouvez pas regrouper des réservations pour plusieurs partenaires. Merci de sélectionner seulement des réservations ayant trait à un même partenaire." +#. module: golem_resource_account +#: model:ir.model,name:golem_resource_account.model_golem_reservation_add_to_invoice_wizard +msgid "golem.reservation.add.to.invoice.wizard" +msgstr "golem.reservation.add.to.invoice.wizard" + #. module: golem_resource_account #: model:ir.model,name:golem_resource_account.model_golem_reservation_invoice_wizard msgid "golem.reservation.invoice.wizard" diff --git a/golem_resource_account/i18n/golem_resource_account.pot b/golem_resource_account/i18n/golem_resource_account.pot index a9df4dc..fe70ded 100644 --- a/golem_resource_account/i18n/golem_resource_account.pot +++ b/golem_resource_account/i18n/golem_resource_account.pot @@ -6,8 +6,8 @@ msgid "" msgstr "" "Project-Id-Version: Odoo Server 10.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2018-03-27 09:39+0000\n" -"PO-Revision-Date: 2018-03-27 09:39+0000\n" +"POT-Creation-Date: 2018-04-16 16:11+0000\n" +"PO-Revision-Date: 2018-04-16 16:11+0000\n" "Last-Translator: <>\n" "Language-Team: \n" "MIME-Version: 1.0\n" @@ -37,6 +37,11 @@ msgstr "" msgid "A generic product can be linked, in order to sell reservations (work in progress)" msgstr "" +#. module: golem_resource_account +#: model:ir.ui.view,arch_db:golem_resource_account.golem_resource_reservation_form_inherit_golem_resource_account +msgid "Add To Invoice" +msgstr "" + #. module: golem_resource_account #: model:ir.model.fields,field_description:golem_resource_account.field_golem_resource_reservation_invoice_line_price_subtotal msgid "Amount" @@ -47,6 +52,11 @@ msgstr "" msgid "Cancel" msgstr "" +#. module: golem_resource_account +#: model:ir.ui.view,arch_db:golem_resource_account.golem_reservation_add_to_invoice_form +msgid "Close" +msgstr "" + #. module: golem_resource_account #: model:ir.ui.view,arch_db:golem_resource_account.golem_resource_reservation_form_inherit_golem_resource_account msgid "Create Invoice" @@ -63,11 +73,13 @@ msgid "Create invoice and Close" msgstr "" #. module: golem_resource_account +#: model:ir.model.fields,field_description:golem_resource_account.field_golem_reservation_add_to_invoice_wizard_create_uid #: model:ir.model.fields,field_description:golem_resource_account.field_golem_reservation_invoice_wizard_create_uid msgid "Created by" msgstr "" #. module: golem_resource_account +#: model:ir.model.fields,field_description:golem_resource_account.field_golem_reservation_add_to_invoice_wizard_create_date #: model:ir.model.fields,field_description:golem_resource_account.field_golem_reservation_invoice_wizard_create_date msgid "Created on" msgstr "" @@ -78,6 +90,7 @@ msgid "Currency" msgstr "" #. module: golem_resource_account +#: model:ir.model.fields,field_description:golem_resource_account.field_golem_reservation_add_to_invoice_wizard_display_name #: model:ir.model.fields,field_description:golem_resource_account.field_golem_reservation_invoice_wizard_display_name msgid "Display Name" msgstr "" @@ -88,11 +101,13 @@ msgid "GOLEM Reservation Model" msgstr "" #. module: golem_resource_account +#: model:ir.model.fields,field_description:golem_resource_account.field_golem_reservation_add_to_invoice_wizard_id #: model:ir.model.fields,field_description:golem_resource_account.field_golem_reservation_invoice_wizard_id msgid "ID" msgstr "" #. module: golem_resource_account +#: model:ir.model,name:golem_resource_account.model_account_invoice #: model:ir.model.fields,field_description:golem_resource_account.field_golem_resource_reservation_invoice_id #: model:ir.ui.view,arch_db:golem_resource_account.golem_resource_reservation_search_inherit_golem_resource_account msgid "Invoice" @@ -124,16 +139,19 @@ msgid "Invoicing" msgstr "" #. module: golem_resource_account +#: model:ir.model.fields,field_description:golem_resource_account.field_golem_reservation_add_to_invoice_wizard___last_update #: model:ir.model.fields,field_description:golem_resource_account.field_golem_reservation_invoice_wizard___last_update msgid "Last Modified on" msgstr "" #. module: golem_resource_account +#: model:ir.model.fields,field_description:golem_resource_account.field_golem_reservation_add_to_invoice_wizard_write_uid #: model:ir.model.fields,field_description:golem_resource_account.field_golem_reservation_invoice_wizard_write_uid msgid "Last Updated by" msgstr "" #. module: golem_resource_account +#: model:ir.model.fields,field_description:golem_resource_account.field_golem_reservation_add_to_invoice_wizard_write_date #: model:ir.model.fields,field_description:golem_resource_account.field_golem_reservation_invoice_wizard_write_date msgid "Last Updated on" msgstr "" @@ -143,11 +161,33 @@ msgstr "" msgid "Linked product" msgstr "" +#. module: golem_resource_account +#: code:addons/golem_resource_account/models/account_invoice.py:41 +#, python-format +msgid "No reservation has been found with {} reservation ID. Please contact your administrator." +msgstr "" + #. module: golem_resource_account #: model:ir.ui.view,arch_db:golem_resource_account.golem_resource_reservation_search_inherit_golem_resource_account msgid "Not invoiced" msgstr "" +#. module: golem_resource_account +#: model:ir.model.fields,field_description:golem_resource_account.field_golem_reservation_add_to_invoice_wizard_invoice_ids +msgid "Partner invoice list" +msgstr "" + +#. module: golem_resource_account +#: code:addons/golem_resource_account/models/golem_resource_reservation.py:130 +#, python-format +msgid "Partner's invoice list" +msgstr "" + +#. module: golem_resource_account +#: model:ir.model.fields,field_description:golem_resource_account.field_golem_reservation_add_to_invoice_wizard_reservation_id +msgid "Reservation id" +msgstr "" + #. module: golem_resource_account #: model:ir.actions.act_window,name:golem_resource_account.action_golem_reservation_invoice_wizard #: model:ir.model.fields,field_description:golem_resource_account.field_golem_reservation_invoice_wizard_reservation_ids @@ -171,12 +211,24 @@ msgstr "" msgid "The reservation \"{}\" is not validated, please validate it before creating invoice" msgstr "" +#. module: golem_resource_account +#: code:addons/golem_resource_account/models/golem_resource_reservation.py:139 +#, python-format +msgid "There is no existing invoice for the current client, please create new one to invoice this reservation" +msgstr "" + #. module: golem_resource_account #: code:addons/golem_resource_account/models/golem_resource_reservation.py:66 #, python-format msgid "There is no income account defined for this product: \"{}\". You have to configure it on the product form." msgstr "" +#. module: golem_resource_account +#: code:addons/golem_resource_account/models/account_invoice.py:35 +#, python-format +msgid "There is no reservation passed through context. Please contact your administrator." +msgstr "" + #. module: golem_resource_account #: model:ir.model.fields,field_description:golem_resource_account.field_golem_resource_reservation_invoice_amount_total msgid "Total" @@ -200,6 +252,11 @@ msgstr "" msgid "You can't group reservations of multiple clients in the same invoice, please remove inadequate reservations" msgstr "" +#. module: golem_resource_account +#: model:ir.model,name:golem_resource_account.model_golem_reservation_add_to_invoice_wizard +msgid "golem.reservation.add.to.invoice.wizard" +msgstr "" + #. module: golem_resource_account #: model:ir.model,name:golem_resource_account.model_golem_reservation_invoice_wizard msgid "golem.reservation.invoice.wizard" diff --git a/golem_resource_account/models/__init__.py b/golem_resource_account/models/__init__.py index 15dcb5c..aaac7ae 100644 --- a/golem_resource_account/models/__init__.py +++ b/golem_resource_account/models/__init__.py @@ -17,4 +17,4 @@ # along with this program. If not, see . -from . import golem_resource_reservation +from . import golem_resource_reservation, account_invoice diff --git a/golem_resource_account/models/account_invoice.py b/golem_resource_account/models/account_invoice.py new file mode 100644 index 0000000..e0360f0 --- /dev/null +++ b/golem_resource_account/models/account_invoice.py @@ -0,0 +1,42 @@ +# -*- coding: utf-8 -*- + +# Copyright 2018 Youssef El Ouahby +# Copyright 2018 Fabien Bourgeois +# +# 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 . + +""" GOLEM Resource Reservation Adaptation""" + +from odoo import models, api, _ +from odoo.exceptions import ValidationError + + +class AccountInvoice(models.Model): + """ Account Invoice """ + _inherit = 'account.invoice' + + @api.multi + def add_to_invoice(self): + """Add reservation to existing invoice """ + for invoice in self: + reservation_id = self._context.get('reservation_id') + if not reservation_id: + raise ValidationError(_('There is no reservation passed through ' + 'context. Please contact your administrator.')) + reservation = self.env['golem.resource.reservation'].browse(reservation_id) + if not reservation: + raise ValidationError(_('No reservation has been found with {} ' + 'reservation ID. Please contact your ' + 'administrator.'.format(reservation_id))) + reservation.create_invoice_line(invoice) diff --git a/golem_resource_account/models/golem_resource_reservation.py b/golem_resource_account/models/golem_resource_reservation.py index c91bf71..94b35ac 100644 --- a/golem_resource_account/models/golem_resource_reservation.py +++ b/golem_resource_account/models/golem_resource_reservation.py @@ -62,7 +62,7 @@ class GolemResourceReservation(models.Model): if not account_id: raise ValidationError( - _('There is no income account defined for this product: "{}"' + _(u'There is no income account defined for this product: "{}"' '. You have to configure it on the product form.'.format(product.name))) @api.multi @@ -120,3 +120,25 @@ class GolemResourceReservation(models.Model): 'res_id': reservation.invoice_id.id, 'view_mode': 'form', 'view_id': self.env.ref('account.invoice_form').id} + + @api.multi + def add_to_invoice(self): + """ Add reservation to existing invoice""" + for reservation in self: + partner = reservation.partner_id + domain = [('partner_id', '=', partner.id), + ('state', '=', 'draft')] + invoice_ids = self.env['account.invoice'].search(domain) + if invoice_ids: + return {'name' : (_('Partner\'s invoice list')), + 'type' : 'ir.actions.act_window', + 'res_model' : 'golem.reservation.add.to.invoice.wizard', + 'context': {'default_invoice_ids': invoice_ids.ids, + 'default_reservation_id': reservation.id}, + 'view_mode': 'form', + 'flags': {'initial_mode': 'view'}, + 'target': 'new'} + else: + raise ValidationError(_('There is no existing invoice for the ' + 'current client, please create new one ' + 'to invoice this reservation')) diff --git a/golem_resource_account/views/golem_resource_reservation_views.xml b/golem_resource_account/views/golem_resource_reservation_views.xml index a17150c..b544466 100644 --- a/golem_resource_account/views/golem_resource_reservation_views.xml +++ b/golem_resource_account/views/golem_resource_reservation_views.xml @@ -43,6 +43,8 @@ along with this program. If not, see . attrs="{'invisible': ['|', ('state', '!=', 'validated'), '|', ('resource_product_id', '=', False), ('invoice_id', '!=', False)]}" /> . -from . import golem_reservation_invoice +from . import golem_reservation_invoice, \ +golem_reservation_add_to_invoice diff --git a/golem_resource_account/wizard/golem_reservation_add_to_invoice.py b/golem_resource_account/wizard/golem_reservation_add_to_invoice.py new file mode 100644 index 0000000..bd50295 --- /dev/null +++ b/golem_resource_account/wizard/golem_reservation_add_to_invoice.py @@ -0,0 +1,27 @@ +# -*- coding: utf-8 -*- + +# Copyright 2018 Youssef El Ouahby +# Copyright 2018 Fabien Bourgeois +# +# 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 . +""" GOLEM Reservation's Adding to invoice wizard""" + +from odoo import models, fields + +class GolemReservationAddToInvoiceWizard(models.TransientModel): + """GOLEM Reservation Add to Invoice Wizard """ + _name = 'golem.reservation.add.to.invoice.wizard' + + invoice_ids = fields.Many2many('account.invoice', string="Partner invoice list") + reservation_id = fields.Many2one('golem.resource.reservation') diff --git a/golem_resource_account/wizard/golem_reservation_add_to_invoice_views.xml b/golem_resource_account/wizard/golem_reservation_add_to_invoice_views.xml new file mode 100644 index 0000000..dc9b433 --- /dev/null +++ b/golem_resource_account/wizard/golem_reservation_add_to_invoice_views.xml @@ -0,0 +1,48 @@ + + + + + + + GOLEM Reservation Add to invoice Form + golem.reservation.add.to.invoice.wizard + +
+ + + + + + + + + + + + + + + + + + +
+ +
+
diff --git a/golem_resource_report/__init__.py b/golem_resource_report/__init__.py new file mode 100644 index 0000000..d766ae4 --- /dev/null +++ b/golem_resource_report/__init__.py @@ -0,0 +1,19 @@ +# -*- coding: utf-8 -*- + +# Copyright 2018 Youssef El Ouahby +# Copyright 2018 Fabien Bourgeois +# +# 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 . + +from . import reports, wizard diff --git a/golem_resource_report/__manifest__.py b/golem_resource_report/__manifest__.py new file mode 100644 index 0000000..8b40f73 --- /dev/null +++ b/golem_resource_report/__manifest__.py @@ -0,0 +1,35 @@ +# -*- coding: utf-8 -*- + +# Copyright 2018 Youssef El Ouahby +# Copyright 2018 Fabien Bourgeois +# +# 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 . + +{ + 'name': 'GOLEM resources reports', + 'summary': 'GOLEM resources reports', + 'description': ''' GOLEM resources reports ''', + 'version': '10.0.0.1.0', + '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'] +} diff --git a/golem_resource_report/data/golem_resource_report_data.xml b/golem_resource_report/data/golem_resource_report_data.xml new file mode 100644 index 0000000..2f00f40 --- /dev/null +++ b/golem_resource_report/data/golem_resource_report_data.xml @@ -0,0 +1,40 @@ + + + + + + + European A4 Landscape + + A4 + 0 + 0 + Landscape + 10 + 23 + 7 + 7 + + 35 + 90 + + + + diff --git a/golem_resource_report/i18n/fr.po b/golem_resource_report/i18n/fr.po new file mode 100644 index 0000000..11c23b8 --- /dev/null +++ b/golem_resource_report/i18n/fr.po @@ -0,0 +1,147 @@ +# 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 14:50+0000\n" +"PO-Revision-Date: 2018-05-25 14:50+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 "
\n" +" To" +msgstr "
\n" +" À" + +#. module: golem_resource_report +#: model:ir.ui.view,arch_db:golem_resource_report.golem_reservation_report +msgid "From Date: " +msgstr "De : " + +#. module: golem_resource_report +#: model:ir.ui.view,arch_db:golem_resource_report.golem_reservation_report +msgid "To Date:" +msgstr "À :" + +#. 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.resource_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.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 "Resources" + +#. module: golem_resource_report +#: model:ir.actions.act_window,name:golem_resource_report.golem_resource_report_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
" +msgstr "réservations
" diff --git a/golem_resource_report/i18n/golem_resource_report.pot b/golem_resource_report/i18n/golem_resource_report.pot new file mode 100644 index 0000000..2d7477b --- /dev/null +++ b/golem_resource_report/i18n/golem_resource_report.pot @@ -0,0 +1,147 @@ +# 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 14:50+0000\n" +"PO-Revision-Date: 2018-05-25 14:50+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 "
\n" +" To" +msgstr "" + +#. module: golem_resource_report +#: model:ir.ui.view,arch_db:golem_resource_report.golem_reservation_report +msgid "From Date: " +msgstr "" + +#. module: golem_resource_report +#: model:ir.ui.view,arch_db:golem_resource_report.golem_reservation_report +msgid "To Date:" +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.resource_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.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.golem_resource_report_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
" +msgstr "" + diff --git a/golem_resource_report/reports/__init__.py b/golem_resource_report/reports/__init__.py new file mode 100644 index 0000000..1c0b8fe --- /dev/null +++ b/golem_resource_report/reports/__init__.py @@ -0,0 +1,19 @@ +# -*- coding: utf-8 -*- + +# Copyright 2018 Youssef El Ouahby +# Copyright 2018 Fabien Bourgeois +# +# 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 . + +from . import golem_reservation_report diff --git a/golem_resource_report/reports/golem_reservation_report.py b/golem_resource_report/reports/golem_reservation_report.py new file mode 100644 index 0000000..8540a86 --- /dev/null +++ b/golem_resource_report/reports/golem_reservation_report.py @@ -0,0 +1,108 @@ +# -*- coding: utf-8 -*- + +# Copyright 2018 Youssef El Ouahby +# Copyright 2018 Fabien Bourgeois +# +# 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 . + +""" 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) diff --git a/golem_resource_report/reports/golem_reservation_report.xml b/golem_resource_report/reports/golem_reservation_report.xml new file mode 100644 index 0000000..1b09f3d --- /dev/null +++ b/golem_resource_report/reports/golem_reservation_report.xml @@ -0,0 +1,80 @@ + + + + + + + + + diff --git a/golem_resource_report/reports/golem_reservation_report_menu.xml b/golem_resource_report/reports/golem_reservation_report_menu.xml new file mode 100644 index 0000000..5ef6c1d --- /dev/null +++ b/golem_resource_report/reports/golem_reservation_report_menu.xml @@ -0,0 +1,32 @@ + + + + + + + + + diff --git a/golem_resource_report/views/golem_resource_report_menu.xml b/golem_resource_report/views/golem_resource_report_menu.xml new file mode 100644 index 0000000..a75dc9a --- /dev/null +++ b/golem_resource_report/views/golem_resource_report_menu.xml @@ -0,0 +1,38 @@ + + + + + + + + Resources Reports + golem.resource.report.wizard + form + form + + {} + new + + + + + + + diff --git a/golem_resource_report/wizard/__init__.py b/golem_resource_report/wizard/__init__.py new file mode 100644 index 0000000..5ae7a4c --- /dev/null +++ b/golem_resource_report/wizard/__init__.py @@ -0,0 +1,19 @@ +# -*- coding: utf-8 -*- + +# Copyright 2018 Youssef El Ouahby +# Copyright 2018 Fabien Bourgeois +# +# 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 . + +from . import golem_resource_report_wizard diff --git a/golem_resource_report/wizard/golem_resource_report_wizard.py b/golem_resource_report/wizard/golem_resource_report_wizard.py new file mode 100644 index 0000000..338118f --- /dev/null +++ b/golem_resource_report/wizard/golem_resource_report_wizard.py @@ -0,0 +1,44 @@ +# -*- coding: utf-8 -*- + +# Copyright 2018 Youssef El Ouahby +# Copyright 2018 Fabien Bourgeois +# +# 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 . + +""" 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) diff --git a/golem_resource_report/wizard/golem_resource_report_wizard_views.xml b/golem_resource_report/wizard/golem_resource_report_wizard_views.xml new file mode 100644 index 0000000..af23086 --- /dev/null +++ b/golem_resource_report/wizard/golem_resource_report_wizard_views.xml @@ -0,0 +1,51 @@ + + + + + + + + GOLEM resource Report Wizard Form + golem.resource.report.wizard + +
+ + + + + + + + + + + + + + +
+
+
+ +
+