forked from Yaltik/golem
Merge branch 'master' into timing_invoice
This commit is contained in:
commit
c89cc9a2ed
@ -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']
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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"
|
||||
|
@ -19,4 +19,5 @@
|
||||
from . import golem_resource_type, \
|
||||
golem_resource_timetable, \
|
||||
golem_resource, \
|
||||
golem_resource_reservation
|
||||
golem_resource_reservation, \
|
||||
product_template
|
||||
|
27
golem_resource/models/product_template.py
Normal file
27
golem_resource/models/product_template.py
Normal file
@ -0,0 +1,27 @@
|
||||
# -*- 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/>.
|
||||
|
||||
""" 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')
|
@ -135,9 +135,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
<menuitem id="resource_configuration_menu" name="Configuration"
|
||||
parent="golem_resource_menu" groups="golem_base.group_golem_manager"
|
||||
sequence="90" />
|
||||
<menuitem id="product_template_menu" name="Sellable Products"
|
||||
parent="resource_configuration_menu"
|
||||
action="product.product_template_action" sequence="20" />
|
||||
|
||||
</data>
|
||||
</odoo>
|
||||
|
45
golem_resource/views/product_template_views.xml
Normal file
45
golem_resource/views/product_template_views.xml
Normal file
@ -0,0 +1,45 @@
|
||||
<?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>
|
||||
|
||||
<!-- Search -->
|
||||
<record id="product_template_search_inherit_resource_view" model="ir.ui.view">
|
||||
<field name="name">product.template.inherit.resource.search</field>
|
||||
<field name="model">product.template</field>
|
||||
<field name="inherit_id" ref='product.product_template_search_view' />
|
||||
<field name="arch" type="xml">
|
||||
<filter name="filter_to_sell" position="after">
|
||||
<filter string="Linked To A Resource" name="filter_resource_linked" domain="[('resource_ids','!=',False)]"/>
|
||||
</filter>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- Actions -->
|
||||
<act_window id="golem_resource_product_action" name="Products"
|
||||
res_model="product.template" view_mode="kanban,tree,form"
|
||||
context="{'search_default_filter_resource_linked': 1}" />
|
||||
|
||||
<!-- Menus -->
|
||||
<menuitem id="product_template_menu" name="Resource Products"
|
||||
parent="resource_configuration_menu"
|
||||
action="golem_resource_product_action" sequence="20" />
|
||||
|
||||
</data>
|
||||
</odoo>
|
@ -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']
|
||||
}
|
||||
|
@ -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 "<strong>\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"
|
||||
|
@ -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"
|
||||
|
@ -17,4 +17,4 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
from . import golem_resource_reservation
|
||||
from . import golem_resource_reservation, account_invoice
|
||||
|
42
golem_resource_account/models/account_invoice.py
Normal file
42
golem_resource_account/models/account_invoice.py
Normal file
@ -0,0 +1,42 @@
|
||||
# -*- 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 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)
|
@ -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'))
|
||||
|
@ -43,6 +43,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
attrs="{'invisible': ['|', ('state', '!=', 'validated'), '|', ('resource_product_id', '=', False), ('invoice_id', '!=', False)]}" />
|
||||
<button name="show_invoice" type="object" string="Show invoice" class="oe_highlight"
|
||||
attrs="{'invisible': [('invoice_id', '=', False)]}" />
|
||||
<button name="add_to_invoice" type="object" string="Add To Invoice" class="oe_highlight"
|
||||
attrs="{'invisible': ['|', ('state', '!=', 'validated'), '|', ('resource_product_id', '=', False), ('invoice_id', '!=', False)]}" />
|
||||
</button>
|
||||
<group name="reservation" position="after">
|
||||
<group name="invoicing" string="Invoicing"
|
||||
|
@ -17,4 +17,5 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
from . import golem_reservation_invoice
|
||||
from . import golem_reservation_invoice, \
|
||||
golem_reservation_add_to_invoice
|
||||
|
@ -0,0 +1,27 @@
|
||||
# -*- 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'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')
|
@ -0,0 +1,48 @@
|
||||
<?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="golem_reservation_add_to_invoice_form" model="ir.ui.view">
|
||||
<field name="name">GOLEM Reservation Add to invoice Form</field>
|
||||
<field name="model">golem.reservation.add.to.invoice.wizard</field>
|
||||
<field name="arch" type="xml">
|
||||
<form>
|
||||
<sheet>
|
||||
<group>
|
||||
<field name="reservation_id" readonly="1" />
|
||||
<field name="invoice_ids" widget="many2many" readonly="1"
|
||||
context="{'reservation_id': reservation_id}">
|
||||
<tree>
|
||||
<field name="partner_id" />
|
||||
<field name="amount_total" />
|
||||
<field name="state" />
|
||||
<button name="add_to_invoice" type="object" icon="fa fa-plus-square" />
|
||||
</tree>
|
||||
</field>
|
||||
</group>
|
||||
</sheet>
|
||||
<footer>
|
||||
<button string="Close" special="cancel" />
|
||||
</footer>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
</data>
|
||||
</odoo>
|
19
golem_resource_pack/__init__.py
Normal file
19
golem_resource_pack/__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 models, wizard
|
33
golem_resource_pack/__manifest__.py
Normal file
33
golem_resource_pack/__manifest__.py
Normal file
@ -0,0 +1,33 @@
|
||||
# -*- 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 pack',
|
||||
'summary': 'GOLEM resources pack',
|
||||
'description': ''' GOLEM resources pack ''',
|
||||
'version': '10.0.0.0.5',
|
||||
'category': 'GOLEM',
|
||||
'author': 'Youssef El Ouahby, Fabien Bourgeois',
|
||||
'license': 'AGPL-3',
|
||||
'application': False,
|
||||
'installable': True,
|
||||
'depends': ['golem_resource'],
|
||||
'data': ['views/golem_resource_pack_views.xml',
|
||||
'wizard/golem_pack_rejection_views.xml',
|
||||
'security/ir.model.access.csv']
|
||||
}
|
209
golem_resource_pack/i18n/fr.po
Normal file
209
golem_resource_pack/i18n/fr.po
Normal file
@ -0,0 +1,209 @@
|
||||
# Translation of Odoo Server.
|
||||
# This file contains the translation of the following modules:
|
||||
# * golem_resource_pack
|
||||
#
|
||||
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"
|
||||
"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_pack
|
||||
#: 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"
|
||||
msgstr "Annuler"
|
||||
|
||||
#. module: golem_resource_pack
|
||||
#: selection:golem.resource.pack,state:0
|
||||
msgid "Canceled"
|
||||
msgstr "Annulé"
|
||||
|
||||
#. module: golem_resource_pack
|
||||
#: model:ir.ui.view,arch_db:golem_resource_pack.golem_resource_pack_view_form
|
||||
msgid "Confirm"
|
||||
msgstr "Confirmer"
|
||||
|
||||
#. module: golem_resource_pack
|
||||
#: selection:golem.resource.pack,state:0
|
||||
msgid "Confirmed"
|
||||
msgstr "Confirmé"
|
||||
|
||||
#. module: golem_resource_pack
|
||||
#: 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_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_rejection_wizard_display_name
|
||||
#: model:ir.model.fields,field_description:golem_resource_pack.field_golem_resource_pack_display_name
|
||||
msgid "Display Name"
|
||||
msgstr "Nom affiché"
|
||||
|
||||
#. module: golem_resource_pack
|
||||
#: selection:golem.resource.pack,state:0
|
||||
msgid "Draft"
|
||||
msgstr "Brouillon"
|
||||
|
||||
#. module: golem_resource_pack
|
||||
#: model:ir.model,name:golem_resource_pack.model_golem_resource_reservation
|
||||
msgid "GOLEM Reservation Model"
|
||||
msgstr "GOLEM Reservation Model"
|
||||
|
||||
#. module: golem_resource_pack
|
||||
#: model:ir.model,name:golem_resource_pack.model_golem_resource_pack
|
||||
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_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_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_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_rejection_wizard_write_date
|
||||
#: model:ir.model.fields,field_description:golem_resource_pack.field_golem_resource_pack_write_date
|
||||
msgid "Last Updated on"
|
||||
msgstr "Dernière mise à jour le"
|
||||
|
||||
#. module: golem_resource_pack
|
||||
#: model:ir.model.fields,field_description:golem_resource_pack.field_golem_resource_pack_name
|
||||
msgid "Name"
|
||||
msgstr "Nom"
|
||||
|
||||
#. module: golem_resource_pack
|
||||
#: model:ir.model.fields,field_description:golem_resource_pack.field_golem_resource_pack_note
|
||||
msgid "Note"
|
||||
msgstr "Note"
|
||||
|
||||
#. module: golem_resource_pack
|
||||
#: model:ir.model.fields,help:golem_resource_pack.field_golem_resource_pack_note
|
||||
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_resource_pack_partner_id
|
||||
msgid "On behalf of"
|
||||
msgstr "Pour le compte de"
|
||||
|
||||
#. module: golem_resource_pack
|
||||
#: model:ir.ui.view,arch_db:golem_resource_pack.golem_resource_pack_view_form
|
||||
msgid "Pack"
|
||||
msgstr "Lot"
|
||||
|
||||
#. module: golem_resource_pack
|
||||
#: 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
|
||||
#, 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
|
||||
#, python-format
|
||||
msgid "Please enter the rejection reason"
|
||||
msgstr "Merci de saisir le motif de refus"
|
||||
|
||||
#. module: golem_resource_pack
|
||||
#: model:ir.model.fields,field_description:golem_resource_pack.field_golem_pack_rejection_wizard_reason
|
||||
msgid "Reason"
|
||||
msgstr "Motif"
|
||||
|
||||
#. module: golem_resource_pack
|
||||
#: 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 "Reject"
|
||||
msgstr "Refus"
|
||||
|
||||
#. module: golem_resource_pack
|
||||
#: selection:golem.resource.pack,state:0
|
||||
msgid "Rejected"
|
||||
msgstr "Refusé"
|
||||
|
||||
#. module: golem_resource_pack
|
||||
#: model:ir.model.fields,field_description:golem_resource_pack.field_golem_resource_pack_rejection_reason
|
||||
#: model:ir.ui.view,arch_db:golem_resource_pack.golem_pack_rejection_wizard_view_form
|
||||
msgid "Rejection reason"
|
||||
msgstr "Motif du refus"
|
||||
|
||||
#. module: golem_resource_pack
|
||||
#: model:ir.actions.act_window,name:golem_resource_pack.golem_resource_pack_action
|
||||
#: model:ir.model.fields,field_description:golem_resource_pack.field_golem_resource_reservation_pack_id
|
||||
msgid "Reservation Pack"
|
||||
msgstr "Lot de réservations"
|
||||
|
||||
#. module: golem_resource_pack
|
||||
#: model:ir.ui.menu,name:golem_resource_pack.golem_resource_packs_menu
|
||||
msgid "Reservation Packs"
|
||||
msgstr "Lots de réservations"
|
||||
|
||||
#. module: golem_resource_pack
|
||||
#: model:ir.model.fields,field_description:golem_resource_pack.field_golem_resource_pack_reservation_count
|
||||
msgid "Reservation count"
|
||||
msgstr "Nombre de réservations"
|
||||
|
||||
#. module: golem_resource_pack
|
||||
#: model:ir.model.fields,field_description:golem_resource_pack.field_golem_resource_pack_reservation_ids
|
||||
msgid "Reservations"
|
||||
msgstr "Réservations"
|
||||
|
||||
#. 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_resource_pack_state
|
||||
msgid "State"
|
||||
msgstr "État"
|
||||
|
||||
#. module: golem_resource_pack
|
||||
#: model:ir.model.fields,field_description:golem_resource_pack.field_golem_resource_pack_user_id
|
||||
msgid "User"
|
||||
msgstr "Utilisateur"
|
||||
|
||||
#. module: golem_resource_pack
|
||||
#: model:ir.ui.view,arch_db:golem_resource_pack.golem_resource_pack_view_form
|
||||
msgid "Validate"
|
||||
msgstr "Valider"
|
||||
|
||||
#. module: golem_resource_pack
|
||||
#: selection:golem.resource.pack,state:0
|
||||
msgid "Validated"
|
||||
msgstr "Validé"
|
||||
|
||||
#. module: golem_resource_pack
|
||||
#: model:ir.model,name:golem_resource_pack.model_golem_pack_rejection_wizard
|
||||
msgid "golem.pack.rejection.wizard"
|
||||
msgstr "golem.pack.rejection.wizard"
|
210
golem_resource_pack/i18n/golem_resource_pack.pot
Normal file
210
golem_resource_pack/i18n/golem_resource_pack.pot
Normal file
@ -0,0 +1,210 @@
|
||||
# Translation of Odoo Server.
|
||||
# This file contains the translation of the following modules:
|
||||
# * golem_resource_pack
|
||||
#
|
||||
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"
|
||||
"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_pack
|
||||
#: 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"
|
||||
msgstr ""
|
||||
|
||||
#. module: golem_resource_pack
|
||||
#: selection:golem.resource.pack,state:0
|
||||
msgid "Canceled"
|
||||
msgstr ""
|
||||
|
||||
#. module: golem_resource_pack
|
||||
#: model:ir.ui.view,arch_db:golem_resource_pack.golem_resource_pack_view_form
|
||||
msgid "Confirm"
|
||||
msgstr ""
|
||||
|
||||
#. module: golem_resource_pack
|
||||
#: selection:golem.resource.pack,state:0
|
||||
msgid "Confirmed"
|
||||
msgstr ""
|
||||
|
||||
#. module: golem_resource_pack
|
||||
#: 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_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_rejection_wizard_display_name
|
||||
#: model:ir.model.fields,field_description:golem_resource_pack.field_golem_resource_pack_display_name
|
||||
msgid "Display Name"
|
||||
msgstr ""
|
||||
|
||||
#. module: golem_resource_pack
|
||||
#: selection:golem.resource.pack,state:0
|
||||
msgid "Draft"
|
||||
msgstr ""
|
||||
|
||||
#. module: golem_resource_pack
|
||||
#: model:ir.model,name:golem_resource_pack.model_golem_resource_reservation
|
||||
msgid "GOLEM Reservation Model"
|
||||
msgstr ""
|
||||
|
||||
#. module: golem_resource_pack
|
||||
#: model:ir.model,name:golem_resource_pack.model_golem_resource_pack
|
||||
msgid "GOLEM Resource Pack Model"
|
||||
msgstr ""
|
||||
|
||||
#. module: golem_resource_pack
|
||||
#: 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_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_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_rejection_wizard_write_date
|
||||
#: model:ir.model.fields,field_description:golem_resource_pack.field_golem_resource_pack_write_date
|
||||
msgid "Last Updated on"
|
||||
msgstr ""
|
||||
|
||||
#. module: golem_resource_pack
|
||||
#: model:ir.model.fields,field_description:golem_resource_pack.field_golem_resource_pack_name
|
||||
msgid "Name"
|
||||
msgstr ""
|
||||
|
||||
#. module: golem_resource_pack
|
||||
#: model:ir.model.fields,field_description:golem_resource_pack.field_golem_resource_pack_note
|
||||
msgid "Note"
|
||||
msgstr ""
|
||||
|
||||
#. module: golem_resource_pack
|
||||
#: model:ir.model.fields,help:golem_resource_pack.field_golem_resource_pack_note
|
||||
msgid "Notes, optional subject for the reservation, reason"
|
||||
msgstr ""
|
||||
|
||||
#. module: golem_resource_pack
|
||||
#: model:ir.model.fields,field_description:golem_resource_pack.field_golem_resource_pack_partner_id
|
||||
msgid "On behalf of"
|
||||
msgstr ""
|
||||
|
||||
#. module: golem_resource_pack
|
||||
#: model:ir.ui.view,arch_db:golem_resource_pack.golem_resource_pack_view_form
|
||||
msgid "Pack"
|
||||
msgstr ""
|
||||
|
||||
#. module: golem_resource_pack
|
||||
#: 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
|
||||
#, 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
|
||||
#, python-format
|
||||
msgid "Please enter the rejection reason"
|
||||
msgstr ""
|
||||
|
||||
#. module: golem_resource_pack
|
||||
#: model:ir.model.fields,field_description:golem_resource_pack.field_golem_pack_rejection_wizard_reason
|
||||
msgid "Reason"
|
||||
msgstr ""
|
||||
|
||||
#. module: golem_resource_pack
|
||||
#: 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 "Reject"
|
||||
msgstr ""
|
||||
|
||||
#. module: golem_resource_pack
|
||||
#: selection:golem.resource.pack,state:0
|
||||
msgid "Rejected"
|
||||
msgstr ""
|
||||
|
||||
#. module: golem_resource_pack
|
||||
#: model:ir.model.fields,field_description:golem_resource_pack.field_golem_resource_pack_rejection_reason
|
||||
#: model:ir.ui.view,arch_db:golem_resource_pack.golem_pack_rejection_wizard_view_form
|
||||
msgid "Rejection reason"
|
||||
msgstr ""
|
||||
|
||||
#. module: golem_resource_pack
|
||||
#: model:ir.actions.act_window,name:golem_resource_pack.golem_resource_pack_action
|
||||
#: model:ir.model.fields,field_description:golem_resource_pack.field_golem_resource_reservation_pack_id
|
||||
msgid "Reservation Pack"
|
||||
msgstr ""
|
||||
|
||||
#. module: golem_resource_pack
|
||||
#: model:ir.ui.menu,name:golem_resource_pack.golem_resource_packs_menu
|
||||
msgid "Reservation Packs"
|
||||
msgstr ""
|
||||
|
||||
#. module: golem_resource_pack
|
||||
#: model:ir.model.fields,field_description:golem_resource_pack.field_golem_resource_pack_reservation_count
|
||||
msgid "Reservation count"
|
||||
msgstr ""
|
||||
|
||||
#. module: golem_resource_pack
|
||||
#: model:ir.model.fields,field_description:golem_resource_pack.field_golem_resource_pack_reservation_ids
|
||||
msgid "Reservations"
|
||||
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_resource_pack_state
|
||||
msgid "State"
|
||||
msgstr ""
|
||||
|
||||
#. module: golem_resource_pack
|
||||
#: model:ir.model.fields,field_description:golem_resource_pack.field_golem_resource_pack_user_id
|
||||
msgid "User"
|
||||
msgstr ""
|
||||
|
||||
#. module: golem_resource_pack
|
||||
#: model:ir.ui.view,arch_db:golem_resource_pack.golem_resource_pack_view_form
|
||||
msgid "Validate"
|
||||
msgstr ""
|
||||
|
||||
#. module: golem_resource_pack
|
||||
#: selection:golem.resource.pack,state:0
|
||||
msgid "Validated"
|
||||
msgstr ""
|
||||
|
||||
#. module: golem_resource_pack
|
||||
#: model:ir.model,name:golem_resource_pack.model_golem_pack_rejection_wizard
|
||||
msgid "golem.pack.rejection.wizard"
|
||||
msgstr ""
|
||||
|
19
golem_resource_pack/models/__init__.py
Normal file
19
golem_resource_pack/models/__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_pack, golem_resource_reservation
|
127
golem_resource_pack/models/golem_resource_pack.py
Normal file
127
golem_resource_pack/models/golem_resource_pack.py
Normal file
@ -0,0 +1,127 @@
|
||||
# -*- 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 Resource Packs """
|
||||
|
||||
from odoo import models, fields, api, _
|
||||
from odoo.exceptions import ValidationError
|
||||
|
||||
|
||||
class GolemResourcePack(models.Model):
|
||||
""" GOLEM Resource Pack Model """
|
||||
_name = 'golem.resource.pack'
|
||||
_description = 'GOLEM Resource Pack Model'
|
||||
_inherit = 'mail.thread'
|
||||
|
||||
name = fields.Char(required=True)
|
||||
reservation_ids = fields.One2many('golem.resource.reservation', 'pack_id',
|
||||
readonly=True, string='Reservations',
|
||||
states={'draft': [('readonly', False)]})
|
||||
|
||||
note = fields.Text(help='Notes, optional subject for the reservation, reason',
|
||||
track_visibility='onchange', readonly=True,
|
||||
states={'draft': [('readonly', False)]})
|
||||
|
||||
user_id = fields.Many2one('res.users', required=True, index=True, readonly=True,
|
||||
string='User', default=lambda self: self.env.user)
|
||||
partner_id = fields.Many2one('res.partner', string='On behalf of', required=True,
|
||||
index=True, track_visibility='onchange', readonly=True,
|
||||
states={'draft': [('readonly', False)]})
|
||||
state = fields.Selection([('canceled', 'Canceled'),
|
||||
('draft', 'Draft'),
|
||||
('confirmed', 'Confirmed'),
|
||||
('validated', 'Validated'),
|
||||
('rejected', 'Rejected')],
|
||||
default='draft', compute='_compute_pack_state',
|
||||
track_visibility='onchange')
|
||||
reservation_count = fields.Integer(compute='_compute_reservation_count')
|
||||
rejection_reason = fields.Text(readonly=True, track_visibility='onchange')
|
||||
|
||||
@api.depends('reservation_ids')
|
||||
def _compute_reservation_count(self):
|
||||
for pack in self:
|
||||
pack.reservation_count = len(pack.reservation_ids)
|
||||
|
||||
@api.depends('reservation_ids', 'reservation_ids.state')
|
||||
def _compute_pack_state(self):
|
||||
""" get pack state """
|
||||
for pack in self:
|
||||
if not pack.reservation_ids:
|
||||
pack.state = 'draft'
|
||||
else:
|
||||
reservation_states = pack.mapped('reservation_ids.state')
|
||||
if 'rejected' in reservation_states:
|
||||
pack.state = 'rejected'
|
||||
elif 'canceled' in reservation_states:
|
||||
pack.state = 'canceled'
|
||||
elif 'draft' in reservation_states:
|
||||
pack.state = 'draft'
|
||||
elif 'confirmed' in reservation_states:
|
||||
pack.state = 'confirmed'
|
||||
elif 'validated' in reservation_states:
|
||||
pack.state = 'validated'
|
||||
|
||||
@api.multi
|
||||
def state_confirm(self):
|
||||
""" pack confirm """
|
||||
for pack in self:
|
||||
pack.reservation_ids.state_confirm()
|
||||
|
||||
@api.multi
|
||||
def state_draft(self):
|
||||
""" pack canceled """
|
||||
for pack in self:
|
||||
pack.reservation_ids.state_draft()
|
||||
|
||||
@api.multi
|
||||
def state_canceled(self):
|
||||
""" pack canceled """
|
||||
for pack in self:
|
||||
pack.reservation_ids.state_canceled()
|
||||
|
||||
@api.multi
|
||||
def state_validated(self):
|
||||
""" pack validated """
|
||||
for pack in self:
|
||||
pack.reservation_ids.state_validated()
|
||||
|
||||
@api.multi
|
||||
def state_rejected(self):
|
||||
""" Wizard call for pack reject """
|
||||
self.ensure_one()
|
||||
pack_id = self[0]
|
||||
return {'name' : _('Please enter the rejection reason'),
|
||||
'type' : 'ir.actions.act_window',
|
||||
'res_model' : 'golem.pack.rejection.wizard',
|
||||
'context': {'default_pack_id': pack_id.id},
|
||||
'view_mode': 'form',
|
||||
'target': 'new'}
|
||||
|
||||
@api.constrains('partner_id')
|
||||
def set_reservation_partner(self):
|
||||
""" Set reservation partner """
|
||||
for pack in self:
|
||||
pack.reservation_ids.write({'partner_id': pack.partner_id.id})
|
||||
|
||||
@api.constrains('reservation_ids')
|
||||
def check_reservation_partner(self):
|
||||
""" Check reservation partner """
|
||||
for pack in self:
|
||||
if len(pack.reservation_ids.mapped('partner_id')) > 1:
|
||||
raise ValidationError(_('Pack partner should be the same for '
|
||||
'all reservations'))
|
29
golem_resource_pack/models/golem_resource_reservation.py
Normal file
29
golem_resource_pack/models/golem_resource_reservation.py
Normal file
@ -0,0 +1,29 @@
|
||||
# -*- 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 Resource Reservation """
|
||||
|
||||
from odoo import models, fields
|
||||
|
||||
|
||||
class GolemResourceReservation(models.Model):
|
||||
""" GOLEM Resource Reservation Model """
|
||||
_inherit = 'golem.resource.reservation'
|
||||
|
||||
pack_id = fields.Many2one('golem.resource.pack', 'Reservation Pack',
|
||||
index=True)
|
3
golem_resource_pack/security/ir.model.access.csv
Normal file
3
golem_resource_pack/security/ir.model.access.csv
Normal file
@ -0,0 +1,3 @@
|
||||
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
|
||||
access_golem_resource_pack_user,Access GOLEM Resource Pack User,model_golem_resource_pack,golem_base.group_golem_user,1,1,1,0
|
||||
access_golem_resource_pack_manager,Access GOLEM Resource Pack Manager,model_golem_resource_pack,golem_base.group_golem_manager,1,1,1,1
|
|
19
golem_resource_pack/tests/__init__.py
Normal file
19
golem_resource_pack/tests/__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 test_golem_resource_pack
|
145
golem_resource_pack/tests/test_golem_resource_pack.py
Normal file
145
golem_resource_pack/tests/test_golem_resource_pack.py
Normal file
@ -0,0 +1,145 @@
|
||||
# -*- 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 Resource Pack testing """
|
||||
|
||||
import logging
|
||||
from odoo.tests.common import TransactionCase
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class TestGolemResourcePack(TransactionCase):
|
||||
""" GOLEM Resource Reservation testing """
|
||||
|
||||
def setUp(self, *args, **kwargs):
|
||||
""" Bootstrap Resource Reservation """
|
||||
super(TestGolemResourcePack, self).setUp(*args, **kwargs)
|
||||
|
||||
self.resource = self.env['golem.resource'].create({
|
||||
'name': 'Resource',
|
||||
'avaibility_start': '2018-01-01',
|
||||
'avaibility_stop': '2020-01-01',
|
||||
'availibility_24_7': True
|
||||
})
|
||||
self.resource_val = self.env['golem.resource'].create({
|
||||
'name': 'Resource to validate',
|
||||
'avaibility_start': '2018-01-01',
|
||||
'avaibility_stop': '2020-01-01',
|
||||
'validation_required': True,
|
||||
'availibility_24_7': True
|
||||
})
|
||||
|
||||
self.partner = self.env['res.partner'].create({'firstname': 'John',
|
||||
'lastname': 'DOE',
|
||||
'is_company': False})
|
||||
|
||||
reservation_obj = self.env['golem.resource.reservation']
|
||||
self.reservation_1 = reservation_obj.create({
|
||||
'resource_id': self.resource.id,
|
||||
'date_start': '2018-02-05 11:00:00',
|
||||
'date_stop': '2018-02-05 12:00:00',
|
||||
'partner_id': self.partner.id
|
||||
})
|
||||
self.reservation_2 = reservation_obj.create({
|
||||
'resource_id': self.resource.id,
|
||||
'date_start': '2018-02-06 11:00:00',
|
||||
'date_stop': '2018-02-06 12:00:00',
|
||||
'partner_id': self.partner.id
|
||||
})
|
||||
self.reservation_3 = reservation_obj.create({
|
||||
'resource_id': self.resource_val.id,
|
||||
'date_start': '2018-02-05 11:00:00', # is monday
|
||||
'date_stop': '2018-02-05 12:00:00',
|
||||
'partner_id': self.partner.id
|
||||
})
|
||||
self.pack_obj = self.env['golem.resource.pack']
|
||||
self.pack_data = {
|
||||
'name': 'Pack Test',
|
||||
'partner_id': self.partner.id
|
||||
}
|
||||
|
||||
|
||||
def test_pack_basic(self):
|
||||
""" Test pack bases """
|
||||
pack = self.pack_obj.create(self.pack_data)
|
||||
self.assertFalse(pack.reservation_ids)
|
||||
self.assertFalse(self.reservation_1.pack_id)
|
||||
pack.reservation_ids = [(4, self.reservation_1.id, 0),
|
||||
(4, self.reservation_2.id, 0)]
|
||||
self.assertEqual(pack.reservation_ids[0].state, "draft")
|
||||
self.assertEqual(self.reservation_1.pack_id.id, pack.id)
|
||||
self.assertEqual(pack.state, "draft")
|
||||
self.assertEqual(pack.reservation_count, 2)
|
||||
#confirm pack ==> all validated
|
||||
pack.state_confirm()#no validation required
|
||||
self.assertEqual(pack.reservation_ids[0].state, "validated")
|
||||
self.assertEqual(pack.state, "validated")
|
||||
#pack draft ==> all draft
|
||||
pack.state_draft()
|
||||
self.assertEqual(pack.reservation_ids[0].state, "draft")
|
||||
self.assertEqual(pack.state, "draft")
|
||||
# confirm pack and draft reservation ==> pack draft
|
||||
pack.state_confirm()
|
||||
pack.reservation_ids[0].state_draft()
|
||||
self.assertEqual(pack.reservation_ids[0].state, "draft")
|
||||
self.assertEqual(pack.state, "draft")
|
||||
#confirm reservation ==> pack validated
|
||||
pack.reservation_ids[0].state_confirm()
|
||||
self.assertEqual(pack.reservation_ids[0].state, "validated")
|
||||
self.assertEqual(pack.state, "validated")
|
||||
pack.reservation_ids = [(5, 0, 0)]
|
||||
self.assertFalse(pack.reservation_ids)
|
||||
self.assertEqual(pack.reservation_count, 0)
|
||||
|
||||
|
||||
def test_pack_validation(self):
|
||||
""" Test pack validation """
|
||||
pack = self.pack_obj.create(self.pack_data)
|
||||
self.assertFalse(pack.reservation_ids)
|
||||
self.assertFalse(self.reservation_1.pack_id)
|
||||
pack.reservation_ids = [(4, self.reservation_1.id, 0),
|
||||
(4, self.reservation_3.id, 0)]
|
||||
self.assertEqual(pack.reservation_ids[0].state, "draft")
|
||||
self.assertEqual(self.reservation_1.pack_id.id, pack.id)
|
||||
self.assertEqual(pack.state, "draft")
|
||||
pack.state_confirm()#validation required
|
||||
self.assertEqual(pack.state, "confirmed")
|
||||
pack.state_validated()
|
||||
self.assertEqual(pack.state, "validated")
|
||||
self.assertEqual(pack.reservation_ids[0].state, "validated")
|
||||
self.assertEqual(pack.reservation_ids[1].state, "validated")
|
||||
|
||||
def test_pack_rejection(self):
|
||||
""" test pack rejection """
|
||||
pack = self.pack_obj.create(self.pack_data)
|
||||
self.assertFalse(pack.reservation_ids)
|
||||
self.assertFalse(self.reservation_1.pack_id)
|
||||
pack.reservation_ids = [(4, self.reservation_1.id, 0),
|
||||
(4, self.reservation_3.id, 0)]
|
||||
self.assertEqual(pack.reservation_ids[0].state, "draft")
|
||||
self.assertEqual(self.reservation_1.pack_id.id, pack.id)
|
||||
self.assertEqual(pack.state, "draft")
|
||||
pack.state_confirm()#validation required
|
||||
rej_wizard = self.env['golem.pack.rejection.wizard'].create({
|
||||
'pack_id': pack.id,
|
||||
'reason' : 'reason1'
|
||||
})
|
||||
rej_wizard.reject()
|
||||
self.assertEqual(pack.state, "rejected")
|
||||
self.assertEqual(self.reservation_3.state, "rejected")
|
||||
self.assertEqual(pack.rejection_reason, 'reason1')
|
91
golem_resource_pack/views/golem_resource_pack_views.xml
Normal file
91
golem_resource_pack/views/golem_resource_pack_views.xml
Normal file
@ -0,0 +1,91 @@
|
||||
<?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>
|
||||
<!-- Trees -->
|
||||
<record model="ir.ui.view" id="golem_resource_pack_view_tree">
|
||||
<field name="name">GOLEM Resource Pack Tree</field>
|
||||
<field name="model">golem.resource.pack</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree colors="black: state=='draft'; blue: state=='validated'; green : state=='validated'; grey: state=='canceled'; orange: state=='rejected'">
|
||||
<field name="name" />
|
||||
<field name="partner_id" />
|
||||
<field name="state" />
|
||||
<field name="reservation_count" />
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- Forms -->
|
||||
<record model="ir.ui.view" id="golem_resource_pack_view_form">
|
||||
<field name="name">GOLEM Resource Pack Form</field>
|
||||
<field name="model">golem.resource.pack</field>
|
||||
<field name="arch" type="xml">
|
||||
<form>
|
||||
<header>
|
||||
<button name="state_confirm" type="object" string="Confirm" class="oe_highlight"
|
||||
attrs="{'invisible': ['|', ('state', 'not in', 'draft'), ('id', '=', False)]}" />
|
||||
<button name="state_canceled" type="object"
|
||||
string="Cancel" states="confirmed,validated" />
|
||||
<button name="state_draft" type="object" string="Set to draft"
|
||||
states="canceled,confirmed,validated,rejected" />
|
||||
<button name="state_validated" type="object" string="Validate"
|
||||
states="confirmed" class="oe_highlight"
|
||||
groups="golem_base.group_golem_manager" />
|
||||
<button name="state_rejected" type="object" string="Reject"
|
||||
states="confirmed" class="oe_highlight"
|
||||
groups="golem_base.group_golem_manager" />
|
||||
<field name="state" widget="statusbar" />
|
||||
</header>
|
||||
<sheet>
|
||||
<group>
|
||||
<group name="general" string="Pack" colspan="2">
|
||||
<field name="id" invisible="1"/>
|
||||
<field name="name" />
|
||||
<field name="user_id" />
|
||||
<field name="partner_id" />
|
||||
<field name="note" />
|
||||
<field name="rejection_reason"
|
||||
attrs="{'invisible': [('state', '!=', 'rejected')]}"/>
|
||||
</group>
|
||||
<group colspan="2" name="reservations">
|
||||
<field name="reservation_ids" widget="many2many"
|
||||
context="{'default_partner_id' : partner_id, 'default_pack_id': active_id, 'search_default_state_draft': 1, 'search_default_partner_id': partner_id}" />
|
||||
</group>
|
||||
</group>
|
||||
</sheet>
|
||||
<div class="oe_chatter">
|
||||
<field name="message_follower_ids" widget="mail_followers" />
|
||||
<field name="message_ids" widget="mail_thread" />
|
||||
</div>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- Actions -->
|
||||
<act_window id="golem_resource_pack_action" name="Reservation Pack"
|
||||
res_model="golem.resource.pack" view_mode="tree,form" />
|
||||
|
||||
<!-- Menus -->
|
||||
<menuitem id="golem_resource_packs_menu" name="Reservation Packs"
|
||||
parent="golem_resource.golem_resource_menu" action="golem_resource_pack_action"
|
||||
sequence="20" />
|
||||
|
||||
</data>
|
||||
</odoo>
|
19
golem_resource_pack/wizard/__init__.py
Normal file
19
golem_resource_pack/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_pack_rejection
|
37
golem_resource_pack/wizard/golem_pack_rejection.py
Normal file
37
golem_resource_pack/wizard/golem_pack_rejection.py
Normal file
@ -0,0 +1,37 @@
|
||||
# -*- 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 Pack management """
|
||||
|
||||
from odoo import models, fields, api
|
||||
|
||||
class GolemReservationRejectionWizard(models.TransientModel):
|
||||
"""GOLEM Resource wizard : refusal reason for a pack """
|
||||
_name = "golem.pack.rejection.wizard"
|
||||
|
||||
pack_id = fields.Many2one('golem.resource.pack', required=True)
|
||||
reason = fields.Text(required=True)
|
||||
|
||||
@api.multi
|
||||
def reject(self):
|
||||
""" Sets pack status to rejected and add reason """
|
||||
self.ensure_one()
|
||||
rdata = {'state': 'rejected',
|
||||
'rejection_reason': self[0].reason}
|
||||
self[0].pack_id.reservation_ids.filtered(lambda r: r.state == 'confirmed').write(rdata)
|
||||
self[0].pack_id.rejection_reason = self[0].reason
|
43
golem_resource_pack/wizard/golem_pack_rejection_views.xml
Normal file
43
golem_resource_pack/wizard/golem_pack_rejection_views.xml
Normal file
@ -0,0 +1,43 @@
|
||||
<?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_rejection_wizard_view_form">
|
||||
<field name="name">GOLEM Pack Rejection Wizard Form</field>
|
||||
<field name="model">golem.pack.rejection.wizard</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Rejection reason">
|
||||
<sheet>
|
||||
<group>
|
||||
<field name="pack_id" readonly="1" />
|
||||
<field name="reason" />
|
||||
</group>
|
||||
</sheet>
|
||||
<footer>
|
||||
<button name="reject" string="Reject" type="object"
|
||||
class="oe_highlight" />
|
||||
<button string="Cancel" class="oe_link" special="cancel" />
|
||||
</footer>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
</data>
|
||||
</odoo>
|
19
golem_resource_pack_account/__init__.py
Normal file
19
golem_resource_pack_account/__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 models
|
32
golem_resource_pack_account/__manifest__.py
Normal file
32
golem_resource_pack_account/__manifest__.py
Normal file
@ -0,0 +1,32 @@
|
||||
# -*- 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 pack invoicing',
|
||||
'summary': 'GOLEM resources pack invoicing',
|
||||
'description': ''' GOLEM resources pack invoicing ''',
|
||||
'version': '10.0.0.1.0',
|
||||
'category': 'GOLEM',
|
||||
'author': 'Youssef El Ouahby, Fabien Bourgeois',
|
||||
'license': 'AGPL-3',
|
||||
'application': False,
|
||||
'installable': True,
|
||||
'auto_install': True,
|
||||
'depends': ['golem_resource_pack', 'golem_resource_account'],
|
||||
'data': ['views/golem_resource_pack_views.xml']
|
||||
}
|
92
golem_resource_pack_account/i18n/fr.po
Normal file
92
golem_resource_pack_account/i18n/fr.po
Normal file
@ -0,0 +1,92 @@
|
||||
# Translation of Odoo Server.
|
||||
# This file contains the translation of the following modules:
|
||||
# * golem_resource_pack_account
|
||||
#
|
||||
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"
|
||||
"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_pack_account
|
||||
#: model:ir.model.fields,help:golem_resource_pack_account.field_golem_resource_pack_invoice_state
|
||||
msgid " * The 'Draft' status is used when a user is encoding a new and unconfirmed Invoice.\n"
|
||||
" * The 'Pro-forma' status is used when the invoice does not have an invoice number.\n"
|
||||
" * The 'Open' status is used when user creates invoice, an invoice number is generated. It stays in the open status till the user pays the invoice.\n"
|
||||
" * The 'Paid' status is set automatically when the invoice is paid. Its related journal entries may or may not be reconciled.\n"
|
||||
" * The 'Cancelled' status is used when user cancel invoice."
|
||||
msgstr "* L'état \"Brouillon\" est utilisé lorsqu'un utilisateur est en train de saisir ou de modifier une nouvelle facture non confirmée.\n"
|
||||
"* L'état \"Pro-forma\" est utilisé lorsque la facture n'a pas de numéro de facture.\n"
|
||||
"* L'état 'Ouvert' est utilisé lorsque l'utilisateur crée une facture, celle-ci a alors un numéro de facture. La facture reste dans l'état \"Ouvert\" tant qu'elle n'est pas payée.\n"
|
||||
"* L'état 'Payé' est affecté automatiquement lorsque la facture est payée. Les écritures correspondantes dans les journaux peuvent ou non être lettrées.\n"
|
||||
"* L'état \"Annulé\" est utilisé lorsque l'utilisateur annule la facture."
|
||||
|
||||
#. module: golem_resource_pack_account
|
||||
#: model:ir.model.fields,field_description:golem_resource_pack_account.field_golem_resource_pack_are_products_set
|
||||
msgid "Are products set"
|
||||
msgstr "Articles liés ?"
|
||||
|
||||
#. module: golem_resource_pack_account
|
||||
#: model:ir.ui.view,arch_db:golem_resource_pack_account.golem_resource_pack_inherit_account_form
|
||||
msgid "Create Invoice"
|
||||
msgstr "Créer une facture"
|
||||
|
||||
#. module: golem_resource_pack_account
|
||||
#: model:ir.model.fields,field_description:golem_resource_pack_account.field_golem_resource_pack_currency_id
|
||||
msgid "Currency"
|
||||
msgstr "Devise"
|
||||
|
||||
#. module: golem_resource_pack_account
|
||||
#: model:ir.model,name:golem_resource_pack_account.model_golem_resource_pack
|
||||
msgid "GOLEM Resource Pack Model"
|
||||
msgstr "GOLEM Resource Pack Model"
|
||||
|
||||
#. module: golem_resource_pack_account
|
||||
#: model:ir.model.fields,field_description:golem_resource_pack_account.field_golem_resource_pack_invoice_id
|
||||
msgid "Invoice"
|
||||
msgstr "Facture"
|
||||
|
||||
#. module: golem_resource_pack_account
|
||||
#: model:ir.ui.view,arch_db:golem_resource_pack_account.golem_resource_pack_inherit_account_form
|
||||
msgid "Invoicing"
|
||||
msgstr "Facturation"
|
||||
|
||||
#. module: golem_resource_pack_account
|
||||
#: model:ir.ui.view,arch_db:golem_resource_pack_account.golem_resource_pack_inherit_account_form
|
||||
msgid "Show invoice"
|
||||
msgstr "Voir la facture"
|
||||
|
||||
#. module: golem_resource_pack_account
|
||||
#: model:ir.model.fields,field_description:golem_resource_pack_account.field_golem_resource_pack_invoice_state
|
||||
msgid "Status"
|
||||
msgstr "État"
|
||||
|
||||
#. module: golem_resource_pack_account
|
||||
#: code:addons/golem_resource_pack_account/models/golem_resource_pack.py:48
|
||||
#, python-format
|
||||
msgid "The current pack is not validated, please validate it before creating invoice"
|
||||
msgstr "Le lot actuel n'est pas validé, merci de le valider avant de pouvoir créer une facture"
|
||||
|
||||
#. module: golem_resource_pack_account
|
||||
#: model:ir.model.fields,field_description:golem_resource_pack_account.field_golem_resource_pack_invoice_amount_total
|
||||
msgid "Total"
|
||||
msgstr "Total"
|
||||
|
||||
#. module: golem_resource_pack_account
|
||||
#: code:addons/golem_resource_pack_account/models/golem_resource_pack.py:54
|
||||
#, python-format
|
||||
msgid "You can not create an invoice as there is already one."
|
||||
msgstr "Vous ne pouvez pas créer une facture s'il y en a déjà une liée."
|
||||
|
||||
#. module: golem_resource_pack_account
|
||||
#: code:addons/golem_resource_pack_account/models/golem_resource_pack.py:51
|
||||
#, python-format
|
||||
msgid "You can not create an invoice for a pack without linked product on every resource reserved."
|
||||
msgstr "Vous ne pouvez pas créer une facture pour un lot sans article pour chacune des ressources liées aux réservations."
|
@ -0,0 +1,89 @@
|
||||
# Translation of Odoo Server.
|
||||
# This file contains the translation of the following modules:
|
||||
# * golem_resource_pack_account
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Odoo Server 10.0\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2018-04-17 06:52+0000\n"
|
||||
"PO-Revision-Date: 2018-04-17 06:52+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_pack_account
|
||||
#: model:ir.model.fields,help:golem_resource_pack_account.field_golem_resource_pack_invoice_state
|
||||
msgid " * The 'Draft' status is used when a user is encoding a new and unconfirmed Invoice.\n"
|
||||
" * The 'Pro-forma' status is used when the invoice does not have an invoice number.\n"
|
||||
" * The 'Open' status is used when user creates invoice, an invoice number is generated. It stays in the open status till the user pays the invoice.\n"
|
||||
" * The 'Paid' status is set automatically when the invoice is paid. Its related journal entries may or may not be reconciled.\n"
|
||||
" * The 'Cancelled' status is used when user cancel invoice."
|
||||
msgstr ""
|
||||
|
||||
#. module: golem_resource_pack_account
|
||||
#: model:ir.model.fields,field_description:golem_resource_pack_account.field_golem_resource_pack_are_products_set
|
||||
msgid "Are products set"
|
||||
msgstr ""
|
||||
|
||||
#. module: golem_resource_pack_account
|
||||
#: model:ir.ui.view,arch_db:golem_resource_pack_account.golem_resource_pack_inherit_account_form
|
||||
msgid "Create Invoice"
|
||||
msgstr ""
|
||||
|
||||
#. module: golem_resource_pack_account
|
||||
#: model:ir.model.fields,field_description:golem_resource_pack_account.field_golem_resource_pack_currency_id
|
||||
msgid "Currency"
|
||||
msgstr ""
|
||||
|
||||
#. module: golem_resource_pack_account
|
||||
#: model:ir.model,name:golem_resource_pack_account.model_golem_resource_pack
|
||||
msgid "GOLEM Resource Pack Model"
|
||||
msgstr ""
|
||||
|
||||
#. module: golem_resource_pack_account
|
||||
#: model:ir.model.fields,field_description:golem_resource_pack_account.field_golem_resource_pack_invoice_id
|
||||
msgid "Invoice"
|
||||
msgstr ""
|
||||
|
||||
#. module: golem_resource_pack_account
|
||||
#: model:ir.ui.view,arch_db:golem_resource_pack_account.golem_resource_pack_inherit_account_form
|
||||
msgid "Invoicing"
|
||||
msgstr ""
|
||||
|
||||
#. module: golem_resource_pack_account
|
||||
#: model:ir.ui.view,arch_db:golem_resource_pack_account.golem_resource_pack_inherit_account_form
|
||||
msgid "Show invoice"
|
||||
msgstr ""
|
||||
|
||||
#. module: golem_resource_pack_account
|
||||
#: model:ir.model.fields,field_description:golem_resource_pack_account.field_golem_resource_pack_invoice_state
|
||||
msgid "Status"
|
||||
msgstr ""
|
||||
|
||||
#. module: golem_resource_pack_account
|
||||
#: code:addons/golem_resource_pack_account/models/golem_resource_pack.py:48
|
||||
#, python-format
|
||||
msgid "The current pack is not validated, please validate it before creating invoice"
|
||||
msgstr ""
|
||||
|
||||
#. module: golem_resource_pack_account
|
||||
#: model:ir.model.fields,field_description:golem_resource_pack_account.field_golem_resource_pack_invoice_amount_total
|
||||
msgid "Total"
|
||||
msgstr ""
|
||||
|
||||
#. module: golem_resource_pack_account
|
||||
#: code:addons/golem_resource_pack_account/models/golem_resource_pack.py:54
|
||||
#, python-format
|
||||
msgid "You can not create an invoice as there is already one."
|
||||
msgstr ""
|
||||
|
||||
#. module: golem_resource_pack_account
|
||||
#: code:addons/golem_resource_pack_account/models/golem_resource_pack.py:51
|
||||
#, python-format
|
||||
msgid "You can not create an invoice for a pack without linked product on every resource reserved."
|
||||
msgstr ""
|
||||
|
19
golem_resource_pack_account/models/__init__.py
Normal file
19
golem_resource_pack_account/models/__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_pack
|
84
golem_resource_pack_account/models/golem_resource_pack.py
Normal file
84
golem_resource_pack_account/models/golem_resource_pack.py
Normal file
@ -0,0 +1,84 @@
|
||||
# -*- 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 Resource Pack Invoicing """
|
||||
|
||||
from odoo import models, fields, api, _
|
||||
from odoo.exceptions import ValidationError
|
||||
|
||||
|
||||
class GolemResourcePack(models.Model):
|
||||
""" GOLEM Resource Pack invoice extention """
|
||||
_inherit = 'golem.resource.pack'
|
||||
|
||||
invoice_id = fields.Many2one('account.invoice', string="Invoice")
|
||||
|
||||
invoice_state = fields.Selection(related='invoice_id.state', store=True,
|
||||
copy=False)
|
||||
invoice_amount_total = fields.Monetary(related='invoice_id.amount_total')
|
||||
currency_id = fields.Many2one(related='invoice_id.currency_id')
|
||||
are_products_set = fields.Boolean(compute="_compute_are_products_set")
|
||||
|
||||
@api.depends('reservation_ids.resource_product_id')
|
||||
def _compute_are_products_set(self):
|
||||
""" Computes are_products_set """
|
||||
for pack in self:
|
||||
pack.are_products_set = all([r.resource_product_id.id for r in pack.reservation_ids])
|
||||
|
||||
@api.multi
|
||||
def chek_pack_to_invoice(self):
|
||||
""" Cheks pack before invoicing """
|
||||
for pack in self:
|
||||
if pack.state != 'validated':
|
||||
raise ValidationError(_('The current pack is not validated, please validate '
|
||||
'it before creating invoice'))
|
||||
elif not pack.are_products_set:
|
||||
raise ValidationError(_('You can not create an invoice for a pack without '
|
||||
'linked product on every resource reserved.'))
|
||||
elif pack.invoice_id.id:
|
||||
raise ValidationError(_('You can not create an invoice as there '
|
||||
'is already one.'))
|
||||
|
||||
@api.multi
|
||||
def create_invoice(self):
|
||||
""" Invoice creation """
|
||||
self.chek_pack_to_invoice()
|
||||
for pack in self:
|
||||
pack.reservation_ids.check_before_invoicing()
|
||||
partner_id = pack.partner_id
|
||||
invoice_id = self.env['account.invoice'].create({
|
||||
'origin': pack.name,
|
||||
'type': 'out_invoice',
|
||||
'reference': False,
|
||||
'account_id': partner_id.property_account_receivable_id.id,
|
||||
'partner_id': partner_id.id
|
||||
})
|
||||
pack.invoice_id = invoice_id.id
|
||||
pack.reservation_ids.create_invoice_line(invoice_id)
|
||||
|
||||
@api.multi
|
||||
def show_invoice(self):
|
||||
""" Redirects to linked invoice """
|
||||
self.ensure_one()
|
||||
pack = self[0]
|
||||
if pack.invoice_id:
|
||||
return {'type': 'ir.actions.act_window',
|
||||
'res_model': 'account.invoice',
|
||||
'res_id': pack.invoice_id.id,
|
||||
'view_mode': 'form',
|
||||
'view_id': self.env.ref('account.invoice_form').id}
|
18
golem_resource_pack_account/tests/__init__.py
Normal file
18
golem_resource_pack_account/tests/__init__.py
Normal file
@ -0,0 +1,18 @@
|
||||
# -*- 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 test_golem_pack_invoice
|
115
golem_resource_pack_account/tests/test_golem_pack_invoice.py
Normal file
115
golem_resource_pack_account/tests/test_golem_pack_invoice.py
Normal file
@ -0,0 +1,115 @@
|
||||
# -*- 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 Resource Reservation testing """
|
||||
|
||||
import logging
|
||||
from odoo.tests.common import TransactionCase
|
||||
from odoo.exceptions import ValidationError
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class TestGolemResourcePack(TransactionCase):
|
||||
""" GOLEM Resource Pack testing """
|
||||
|
||||
def setUp(self, *args, **kwargs):
|
||||
""" Bootstrap Resource Reservation """
|
||||
super(TestGolemResourcePack, self).setUp(*args, **kwargs)
|
||||
# set product
|
||||
self.product = self.env['product.template'].create({
|
||||
'name': 'Product',
|
||||
'categ_id': self.env.ref('product.product_category_all').id,
|
||||
'list_price': 7.0,
|
||||
'type': 'service',
|
||||
'uom_id': self.env.ref('product.product_uom_hour').id,
|
||||
'uom_po_id': self.env.ref('product.product_uom_hour').id,
|
||||
'property_account_income_id': self.env.ref('l10n_fr.pcg_706').id
|
||||
})
|
||||
#set resources
|
||||
self.resource_1 = self.env['golem.resource'].create({
|
||||
'name': 'Resource1',
|
||||
'product_tmpl_id': self.product.id,
|
||||
'avaibility_start': '2018-01-01',
|
||||
'avaibility_stop': '2020-01-01',
|
||||
'availibility_24_7': True
|
||||
})
|
||||
self.resource_2 = self.env['golem.resource'].create({
|
||||
'name': 'Resource2',
|
||||
'avaibility_start': '2018-01-01',
|
||||
'avaibility_stop': '2020-01-01',
|
||||
'availibility_24_7': True
|
||||
})
|
||||
|
||||
#set partners
|
||||
self.partner_1 = self.env['res.partner'].create({'firstname': 'John',
|
||||
'lastname': 'DOE',
|
||||
'is_company': False})
|
||||
self.partner_2 = self.env['res.partner'].create({'firstname': 'John2',
|
||||
'lastname': 'DOE2',
|
||||
'is_company': False})
|
||||
|
||||
# set reservations
|
||||
self.reservation_1 = self.env['golem.resource.reservation'].create({
|
||||
'resource_id': self.resource_1.id,
|
||||
'date_start': '2018-02-05 11:00:00',
|
||||
'date_stop': '2018-02-05 12:00:00',
|
||||
'partner_id': self.partner_1.id
|
||||
})
|
||||
self.reservation_2 = self.env['golem.resource.reservation'].create({
|
||||
'resource_id': self.resource_1.id,
|
||||
'date_start': '2018-02-06 11:00:00',
|
||||
'date_stop': '2018-02-06 12:00:00',
|
||||
'partner_id': self.partner_1.id
|
||||
})
|
||||
|
||||
#set pack env
|
||||
self.pack_obj = self.env['golem.resource.pack']
|
||||
self.pack_data = {
|
||||
'name': 'Pack test',
|
||||
'partner_id': self.partner_1.id,
|
||||
'reservation_ids': [(4, self.reservation_1.id, 0),
|
||||
(4, self.reservation_2.id, 0)]}
|
||||
|
||||
|
||||
def test_pack_invoice_basic(self):
|
||||
""" Test pack invoice basic """
|
||||
pack = self.pack_obj.create(self.pack_data)
|
||||
pack.state_confirm()
|
||||
pack.create_invoice()
|
||||
self.assertTrue(pack.invoice_id.id)
|
||||
self.assertEqual(pack.invoice_state, 'draft')
|
||||
|
||||
def test_unallowed_pack_invoice(self):
|
||||
""" Test unallowed pack invoice cases """
|
||||
pack = self.pack_obj.create(self.pack_data)
|
||||
with self.assertRaises(ValidationError) as err:
|
||||
pack.create_invoice()
|
||||
self.assertIn(u'current pack is not validated', err.exception.args[0])
|
||||
self.reservation_2.write({'resource_id': self.resource_2.id})#no product linked
|
||||
pack.state_confirm()
|
||||
with self.assertRaises(ValidationError) as err:
|
||||
pack.create_invoice()
|
||||
self.assertIn(u'linked product on every resource', err.exception.args[0])
|
||||
pack.state_draft()
|
||||
self.reservation_2.write({'resource_id': self.resource_1.id})# with product linked
|
||||
pack.state_confirm()
|
||||
pack.create_invoice()
|
||||
self.assertTrue(pack.invoice_id.id)
|
||||
with self.assertRaises(ValidationError) as err:
|
||||
pack.create_invoice()
|
||||
self.assertIn(u'can not create an invoice as there', err.exception.args[0])
|
@ -0,0 +1,59 @@
|
||||
<?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>
|
||||
|
||||
<!-- Tree -->
|
||||
<record model="ir.ui.view" id="golem_resource_pack_inherit_account_tree">
|
||||
<field name="name">GOLEM Resource Pack Account extention Tree</field>
|
||||
<field name="model">golem.resource.pack</field>
|
||||
<field name="inherit_id" ref="golem_resource_pack.golem_resource_pack_view_tree"/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="reservation_count" position="after">
|
||||
<field name="invoice_state" />
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- Forms -->
|
||||
<record model="ir.ui.view" id="golem_resource_pack_inherit_account_form">
|
||||
<field name="name">GOLEM Resource Pack Account extention Form</field>
|
||||
<field name="model">golem.resource.pack</field>
|
||||
<field name="inherit_id" ref="golem_resource_pack.golem_resource_pack_view_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<button name="state_rejected" position="after">
|
||||
<button name="create_invoice" type="object" string="Create Invoice" class="oe_highlight"
|
||||
attrs="{'invisible': ['|', ('state', '!=', 'validated'), '|', ('invoice_id', '!=', False), ('are_products_set', '=', False)]}" />
|
||||
<button name="show_invoice" type="object" string="Show invoice" class="oe_highlight"
|
||||
attrs="{'invisible': [('invoice_id', '=', False)]}" />
|
||||
</button>
|
||||
<group name="general" position="after">
|
||||
<group name="invoicing" string="Invoicing"
|
||||
attrs="{'invisible': [('invoice_id', '=', False)]}">
|
||||
<field name="are_products_set" invisible="1"/>
|
||||
<field name="invoice_id" />
|
||||
<field name="invoice_state" />
|
||||
<field name="invoice_amount_total" />
|
||||
</group>
|
||||
</group>
|
||||
</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.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']
|
||||
}
|
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>
|
147
golem_resource_report/i18n/fr.po
Normal file
147
golem_resource_report/i18n/fr.po
Normal file
@ -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 "<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.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<br/>"
|
||||
msgstr "réservations<br/>"
|
147
golem_resource_report/i18n/golem_resource_report.pot
Normal file
147
golem_resource_report/i18n/golem_resource_report.pot
Normal file
@ -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 "<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.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<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>
|
38
golem_resource_report/views/golem_resource_report_menu.xml
Normal file
38
golem_resource_report/views/golem_resource_report_menu.xml
Normal file
@ -0,0 +1,38 @@
|
||||
<?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="golem_resource_report_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="resource_report_menu" name="Report" parent="golem_resource.golem_resource_menu"
|
||||
action="golem_resource_report_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…
x
Reference in New Issue
Block a user