Merge branch 'master' into golem_resource_option

This commit is contained in:
eloyoussef 2018-03-27 15:41:28 +02:00
commit b8f477ffc4
19 changed files with 1020 additions and 24 deletions

View File

@ -159,7 +159,7 @@ msgstr "Membres de la famille"
#. module: golem_family #. module: golem_family
#: model:ir.ui.view,arch_db:golem_family.golem_family_form #: model:ir.ui.view,arch_db:golem_family.golem_family_form
msgid "Family form" msgid "Family form"
msgstr "Family form" msgstr "Fiche Famille"
#. module: golem_family #. module: golem_family
#: model:ir.ui.view,arch_db:golem_family.golem_family_form #: model:ir.ui.view,arch_db:golem_family.golem_family_form

View File

@ -18,7 +18,7 @@
{ {
'name': 'GOLEM non-profit membership handling', 'name': 'GOLEM non-profit membership handling',
'summary': 'Extends Odoo membership', 'summary': 'Extends Odoo membership',
'version': '10.0.1.1.2', 'version': '10.0.1.1.3',
'category': 'GOLEM', 'category': 'GOLEM',
'author': 'Fabien Bourgeois, Michel Dessenne', 'author': 'Fabien Bourgeois, Michel Dessenne',
'license': 'AGPL-3', 'license': 'AGPL-3',
@ -27,5 +27,5 @@
'depends': ['golem_member', 'account', 'decimal_precision'], 'depends': ['golem_member', 'account', 'decimal_precision'],
'data': ['views/golem_membership_invoice.xml', 'data': ['views/golem_membership_invoice.xml',
'views/golem_member_view.xml', 'views/golem_member_view.xml',
'report/golem_member_card_template.xml'] 'report/golem_member_card_templates.xml']
} }

View File

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

View File

@ -6,8 +6,8 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: Odoo Server 10.0\n" "Project-Id-Version: Odoo Server 10.0\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-03-17 08:07+0000\n" "POT-Creation-Date: 2018-03-26 15:36+0000\n"
"PO-Revision-Date: 2018-03-17 08:07+0000\n" "PO-Revision-Date: 2018-03-26 15:36+0000\n"
"Last-Translator: <>\n" "Last-Translator: <>\n"
"Language-Team: \n" "Language-Team: \n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
@ -95,6 +95,11 @@ msgstr "Confirmer"
msgid "Confirmed" msgid "Confirmed"
msgstr "Confirmé" msgstr "Confirmé"
#. module: golem_resource
#: model:ir.ui.view,arch_db:golem_resource.golem_resource_reservation_view_search
msgid "Confirmed, to Validate"
msgstr "Confirmé, à valider"
#. module: golem_resource #. module: golem_resource
#: model:ir.model.fields,field_description:golem_resource.field_golem_reservation_rejection_wizard_create_uid #: model:ir.model.fields,field_description:golem_resource.field_golem_reservation_rejection_wizard_create_uid
#: model:ir.model.fields,field_description:golem_resource.field_golem_resource_create_uid #: model:ir.model.fields,field_description:golem_resource.field_golem_resource_create_uid
@ -134,6 +139,7 @@ msgstr "Nom affiché"
#. module: golem_resource #. module: golem_resource
#: selection:golem.resource.reservation,state:0 #: selection:golem.resource.reservation,state:0
#: model:ir.ui.view,arch_db:golem_resource.golem_resource_reservation_view_search
msgid "Draft" msgid "Draft"
msgstr "Brouillon" msgstr "Brouillon"
@ -320,6 +326,7 @@ msgstr "Rejet"
#. module: golem_resource #. module: golem_resource
#: selection:golem.resource.reservation,state:0 #: selection:golem.resource.reservation,state:0
#: model:ir.ui.view,arch_db:golem_resource.golem_resource_reservation_view_search
msgid "Rejected" msgid "Rejected"
msgstr "Rejeté" msgstr "Rejeté"
@ -344,11 +351,6 @@ msgstr "Nombre de réservations"
msgid "Reservation id" msgid "Reservation id"
msgstr "Reservation id" msgstr "Reservation id"
#. module: golem_resource
#: model:ir.ui.view,arch_db:golem_resource.golem_resource_reservation_view_search
msgid "Reservation to Validate"
msgstr "Réservation à valider"
#. module: golem_resource #. module: golem_resource
#: model:ir.actions.act_window,name:golem_resource.golem_resource_reservation_action #: model:ir.actions.act_window,name:golem_resource.golem_resource_reservation_action
#: model:ir.model.fields,field_description:golem_resource.field_golem_resource_reservation_ids #: model:ir.model.fields,field_description:golem_resource.field_golem_resource_reservation_ids
@ -407,6 +409,11 @@ msgstr "Ressources"
msgid "Saturday" msgid "Saturday"
msgstr "Samedi" 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 #. module: golem_resource
#: model:ir.ui.view,arch_db:golem_resource.golem_resource_reservation_view_form #: model:ir.ui.view,arch_db:golem_resource.golem_resource_reservation_view_form
msgid "Set to draft" msgid "Set to draft"
@ -499,6 +506,7 @@ msgstr "Valider"
#. module: golem_resource #. module: golem_resource
#: selection:golem.resource.reservation,state:0 #: selection:golem.resource.reservation,state:0
#: model:ir.ui.view,arch_db:golem_resource.golem_resource_reservation_view_search
msgid "Validated" msgid "Validated"
msgstr "Validé" msgstr "Validé"

View File

@ -6,8 +6,8 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: Odoo Server 10.0\n" "Project-Id-Version: Odoo Server 10.0\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-03-17 08:07+0000\n" "POT-Creation-Date: 2018-03-26 15:37+0000\n"
"PO-Revision-Date: 2018-03-17 08:07+0000\n" "PO-Revision-Date: 2018-03-26 15:37+0000\n"
"Last-Translator: <>\n" "Last-Translator: <>\n"
"Language-Team: \n" "Language-Team: \n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
@ -95,6 +95,11 @@ msgstr ""
msgid "Confirmed" msgid "Confirmed"
msgstr "" msgstr ""
#. module: golem_resource
#: model:ir.ui.view,arch_db:golem_resource.golem_resource_reservation_view_search
msgid "Confirmed, to Validate"
msgstr ""
#. module: golem_resource #. module: golem_resource
#: model:ir.model.fields,field_description:golem_resource.field_golem_reservation_rejection_wizard_create_uid #: model:ir.model.fields,field_description:golem_resource.field_golem_reservation_rejection_wizard_create_uid
#: model:ir.model.fields,field_description:golem_resource.field_golem_resource_create_uid #: model:ir.model.fields,field_description:golem_resource.field_golem_resource_create_uid
@ -134,6 +139,7 @@ msgstr ""
#. module: golem_resource #. module: golem_resource
#: selection:golem.resource.reservation,state:0 #: selection:golem.resource.reservation,state:0
#: model:ir.ui.view,arch_db:golem_resource.golem_resource_reservation_view_search
msgid "Draft" msgid "Draft"
msgstr "" msgstr ""
@ -320,6 +326,7 @@ msgstr ""
#. module: golem_resource #. module: golem_resource
#: selection:golem.resource.reservation,state:0 #: selection:golem.resource.reservation,state:0
#: model:ir.ui.view,arch_db:golem_resource.golem_resource_reservation_view_search
msgid "Rejected" msgid "Rejected"
msgstr "" msgstr ""
@ -344,11 +351,6 @@ msgstr ""
msgid "Reservation id" msgid "Reservation id"
msgstr "" msgstr ""
#. module: golem_resource
#: model:ir.ui.view,arch_db:golem_resource.golem_resource_reservation_view_search
msgid "Reservation to Validate"
msgstr ""
#. module: golem_resource #. module: golem_resource
#: model:ir.actions.act_window,name:golem_resource.golem_resource_reservation_action #: model:ir.actions.act_window,name:golem_resource.golem_resource_reservation_action
#: model:ir.model.fields,field_description:golem_resource.field_golem_resource_reservation_ids #: model:ir.model.fields,field_description:golem_resource.field_golem_resource_reservation_ids
@ -407,6 +409,11 @@ msgstr ""
msgid "Saturday" msgid "Saturday"
msgstr "" msgstr ""
#. module: golem_resource
#: model:ir.ui.menu,name:golem_resource.product_template_menu
msgid "Sellable Products"
msgstr ""
#. module: golem_resource #. module: golem_resource
#: model:ir.ui.view,arch_db:golem_resource.golem_resource_reservation_view_form #: model:ir.ui.view,arch_db:golem_resource.golem_resource_reservation_view_form
msgid "Set to draft" msgid "Set to draft"
@ -499,6 +506,7 @@ msgstr ""
#. module: golem_resource #. module: golem_resource
#: selection:golem.resource.reservation,state:0 #: selection:golem.resource.reservation,state:0
#: model:ir.ui.view,arch_db:golem_resource.golem_resource_reservation_view_search
msgid "Validated" msgid "Validated"
msgstr "" msgstr ""

View File

@ -24,10 +24,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<field name="name">GOLEM Resource Reservation Calendar</field> <field name="name">GOLEM Resource Reservation Calendar</field>
<field name="model">golem.resource.reservation</field> <field name="model">golem.resource.reservation</field>
<field name="arch" type="xml"> <field name="arch" type="xml">
<calendar date_start="date_start" date_stop="date_stop" color="resource_id"> <calendar date_start="date_start" date_stop="date_stop" color="resource_id"
event_open_popup="%(golem_resource.golem_resource_reservation_view_form)s"
mode="month">
<field name="resource_id" /> <field name="resource_id" />
<field name="user_id" />
<field name="partner_id" /> <field name="partner_id" />
<field name="note" />
</calendar> </calendar>
</field> </field>
</record> </record>
@ -37,12 +39,14 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<field name="name">GOLEM Resource Reservation Tree</field> <field name="name">GOLEM Resource Reservation Tree</field>
<field name="model">golem.resource.reservation</field> <field name="model">golem.resource.reservation</field>
<field name="arch" type="xml"> <field name="arch" type="xml">
<tree> <tree colors="black: state=='draft'; blue: state=='validated'; gree : state=='validated'; grey: state=='canceled'; orange: state=='rejected'">
<field name="resource_id" /> <field name="resource_id" />
<field name="date_start" /> <field name="date_start" />
<field name="date_stop" /> <field name="date_stop" />
<field name="partner_id" /> <field name="partner_id" />
<field name="state" /> <field name="state" />
<field name='day_start' invisible='1'/>
</tree> </tree>
</field> </field>
</record> </record>
@ -70,7 +74,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
</header> </header>
<sheet> <sheet>
<group> <group>
<group string="Resource"> <group name="resource" string="Resource">
<field name="id" invisible="1" /> <field name="id" invisible="1" />
<field name="resource_id" options="{'no_create': True}" /> <field name="resource_id" options="{'no_create': True}" />
<field name="resource_option_ids" widget="many2many_tags" readonly="1"/> <field name="resource_option_ids" widget="many2many_tags" readonly="1"/>
@ -80,7 +84,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<field name="resource_timetable_ids" readonly="1" <field name="resource_timetable_ids" readonly="1"
attrs="{'invisible': [('resource_avaibility_24_7', '=', True)]}" /> attrs="{'invisible': [('resource_avaibility_24_7', '=', True)]}" />
</group> </group>
<group string="Reservation"> <group name="reservation" string="Reservation">
<group> <group>
<field name="date_start" /> <field name="date_start" />
<field name="date_stop" /> <field name="date_stop" />
@ -117,12 +121,28 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<search> <search>
<field name="date_start" /> <field name="date_start" />
<field name="date_stop" /> <field name="date_stop" />
<field name="day_start"/>
<field name="resource_id" /> <field name="resource_id" />
<field name="user_id" /> <field name="user_id" />
<field name="partner_id" /> <field name="partner_id" />
<field name="state" /> <field name="state" />
<filter name="to_validate" string="Reservation to Validate" <filter name="state_draft" string="Draft"
domain="[('state', '=', 'draft')]" />
<filter name="state_confirmed" string="Confirmed, to Validate"
domain="[('state', '=', 'confirmed')]" /> domain="[('state', '=', 'confirmed')]" />
<filter name="state_validated" string="Validated"
domain="[('state', '=', 'validated')]" />
<filter name="state_rejected" string="Rejected"
domain="[('state', '=', 'rejected')]" />
<separator />
<filter name="day_reservation" string="Day Reservation"
domain="[('day_start', '=', context_today().strftime('%%Y-%%m-%%d'))]" />
<filter name="7days_reservation" string="7 Days Reservations"
domain="[('date_start', '&gt;=', (context_today()+datetime.timedelta(days=0)).strftime('%%Y-%%m-%%d')),
('date_start', '&lt;=', (context_today()+datetime.timedelta(days=7)).strftime('%%Y-%%m-%%d'))]" />
<filter name="30days_reservation" string="30 Days Reservations"
domain="[('date_start', '&gt;=', (context_today()+datetime.timedelta(days=0)).strftime('%%Y-%%m-%%d')),
('date_start', '&lt;=', (context_today()+datetime.timedelta(days=30)).strftime('%%Y-%%m-%%d'))]" />
<filter name="group_state" string="State" <filter name="group_state" string="State"
context="{'group_by': 'state'}" /> context="{'group_by': 'state'}" />
<filter name="group_resource" string="Resource" <filter name="group_resource" string="Resource"

View File

@ -137,6 +137,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<menuitem id="resource_configuration_menu" name="Configuration" <menuitem id="resource_configuration_menu" name="Configuration"
parent="golem_resource_menu" groups="golem_base.group_golem_manager" parent="golem_resource_menu" groups="golem_base.group_golem_manager"
sequence="90" /> sequence="90" />
<menuitem id="product_template_menu" name="Sellable Products"
parent="resource_configuration_menu"
action="product.product_template_action" sequence="20" />
</data> </data>
</odoo> </odoo>

View 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

View 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 invoicing',
'summary': 'GOLEM resources invoicing',
'description': ''' GOLEM resources invoicing ''',
'version': '10.0.0.1.3',
'category': 'GOLEM',
'author': 'Youssef El Ouahby, Fabien Bourgeois',
'license': 'AGPL-3',
'application': True,
'installable': True,
'depends': ['golem_resource', 'account'],
'data': ['wizard/golem_reservation_invoice_views.xml',
'views/golem_resource_reservation_views.xml']
}

View File

@ -0,0 +1,213 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * golem_resource_account
#
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"
"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_account
#: model:ir.model.fields,help:golem_resource_account.field_golem_resource_reservation_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_account
#: model:ir.ui.view,arch_db:golem_resource_account.golem_reservation_invoice_wizard_form
msgid "<strong>\n"
" Only one invoice will be created in draft with corresponding reservations.\n"
" Then, you will be redirected to the new invoice and can review it before validation.\n"
" </strong>"
msgstr "<strong>\n"
" Seule unef acture sera créée en brouillon avec les réservations sélectionnées.\n"
" Ensuite, vous serez redirigé vers cette facture et pourrez la visionner avant de la valider.\n"
" </strong>"
#. module: golem_resource_account
#: model:ir.model.fields,help:golem_resource_account.field_golem_resource_reservation_resource_product_id
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.model.fields,field_description:golem_resource_account.field_golem_resource_reservation_invoice_line_price_subtotal
msgid "Amount"
msgstr "Montant"
#. module: golem_resource_account
#: model:ir.ui.view,arch_db:golem_resource_account.golem_reservation_invoice_wizard_form
msgid "Cancel"
msgstr "Annuler"
#. module: golem_resource_account
#: model:ir.ui.view,arch_db:golem_resource_account.golem_resource_reservation_form_inherit_golem_resource_account
msgid "Create Invoice"
msgstr "Créer une facture"
#. module: golem_resource_account
#: model:ir.ui.view,arch_db:golem_resource_account.golem_reservation_invoice_wizard_form
msgid "Create and view invoice"
msgstr "Créer et afficher la facture"
#. module: golem_resource_account
#: model:ir.ui.view,arch_db:golem_resource_account.golem_reservation_invoice_wizard_form
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_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_invoice_wizard_create_date
msgid "Created on"
msgstr "Créé le"
#. module: golem_resource_account
#: model:ir.model.fields,field_description:golem_resource_account.field_golem_resource_reservation_currency_id
msgid "Currency"
msgstr "Devise"
#. module: golem_resource_account
#: model:ir.model.fields,field_description:golem_resource_account.field_golem_reservation_invoice_wizard_display_name
msgid "Display Name"
msgstr "Nom affiché"
#. module: golem_resource_account
#: model:ir.model,name:golem_resource_account.model_golem_resource_reservation
msgid "GOLEM Reservation Model"
msgstr "GOLEM Reservation Model"
#. module: golem_resource_account
#: 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.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"
msgstr "Facture"
#. module: golem_resource_account
#: model:ir.model.fields,field_description:golem_resource_account.field_golem_resource_reservation_invoice_line_id
msgid "Invoice line id"
msgstr "Ligne de facturation"
#. module: golem_resource_account
#: model:ir.ui.view,arch_db:golem_resource_account.golem_resource_reservation_search_inherit_golem_resource_account
msgid "Invoice state"
msgstr "État de la facture"
#. module: golem_resource_account
#: model:ir.ui.view,arch_db:golem_resource_account.golem_resource_reservation_tree_inherit_golem_resource_account
msgid "Invoice status"
msgstr "État de facturation"
#. module: golem_resource_account
#: model:ir.ui.view,arch_db:golem_resource_account.golem_resource_reservation_search_inherit_golem_resource_account
msgid "Invoiced"
msgstr "Facturé"
#. module: golem_resource_account
#: model:ir.ui.view,arch_db:golem_resource_account.golem_resource_reservation_form_inherit_golem_resource_account
msgid "Invoicing"
msgstr "Facturation"
#. module: golem_resource_account
#: 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_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_invoice_wizard_write_date
msgid "Last Updated on"
msgstr "Dernière mise à jour le"
#. module: golem_resource_account
#: model:ir.model.fields,field_description:golem_resource_account.field_golem_resource_reservation_resource_product_id
msgid "Linked product"
msgstr "Article lié"
#. 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.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
#: model:ir.ui.view,arch_db:golem_resource_account.golem_reservation_invoice_wizard_form
msgid "Reservations to invoice"
msgstr "Facturer les réservations"
#. module: golem_resource_account
#: model:ir.ui.view,arch_db:golem_resource_account.golem_resource_reservation_form_inherit_golem_resource_account
msgid "Show invoice"
msgstr "Voir la facture"
#. module: golem_resource_account
#: model:ir.model.fields,field_description:golem_resource_account.field_golem_resource_reservation_invoice_state
msgid "Status"
msgstr "État"
#. module: golem_resource_account
#: code:addons/golem_resource_account/models/golem_resource_reservation.py:50
#, python-format
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: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
#: model:ir.model.fields,field_description:golem_resource_account.field_golem_resource_reservation_invoice_amount_total
msgid "Total"
msgstr "Total"
#. module: golem_resource_account
#: code:addons/golem_resource_account/models/golem_resource_reservation.py:52
#, python-format
msgid "You can not create an invoice as there is already one."
msgstr "Vous ne pouvez pa créer une facture s'il y en a déjà une existante."
#. module: golem_resource_account
#: code:addons/golem_resource_account/models/golem_resource_reservation.py:57
#, python-format
msgid "You can not create an invoice without linked product on the resource reserved."
msgstr "Vous ne pouvez pas créer de facture sans article liée à la ressource réservée."
#. module: golem_resource_account
#: code:addons/golem_resource_account/models/golem_resource_reservation.py:43
#, python-format
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_invoice_wizard
msgid "golem.reservation.invoice.wizard"
msgstr "golem.reservation.invoice.wizard"

View File

@ -0,0 +1,207 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * golem_resource_account
#
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"
"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_account
#: model:ir.model.fields,help:golem_resource_account.field_golem_resource_reservation_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_account
#: model:ir.ui.view,arch_db:golem_resource_account.golem_reservation_invoice_wizard_form
msgid "<strong>\n"
" Only one invoice will be created in draft with corresponding reservations.\n"
" Then, you will be redirected to the new invoice and can review it before validation.\n"
" </strong>"
msgstr ""
#. module: golem_resource_account
#: model:ir.model.fields,help:golem_resource_account.field_golem_resource_reservation_resource_product_id
msgid "A generic product can be linked, in order to sell reservations (work in progress)"
msgstr ""
#. module: golem_resource_account
#: model:ir.model.fields,field_description:golem_resource_account.field_golem_resource_reservation_invoice_line_price_subtotal
msgid "Amount"
msgstr ""
#. module: golem_resource_account
#: model:ir.ui.view,arch_db:golem_resource_account.golem_reservation_invoice_wizard_form
msgid "Cancel"
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"
msgstr ""
#. module: golem_resource_account
#: model:ir.ui.view,arch_db:golem_resource_account.golem_reservation_invoice_wizard_form
msgid "Create and view invoice"
msgstr ""
#. module: golem_resource_account
#: model:ir.ui.view,arch_db:golem_resource_account.golem_reservation_invoice_wizard_form
msgid "Create invoice and Close"
msgstr ""
#. module: golem_resource_account
#: 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_invoice_wizard_create_date
msgid "Created on"
msgstr ""
#. module: golem_resource_account
#: model:ir.model.fields,field_description:golem_resource_account.field_golem_resource_reservation_currency_id
msgid "Currency"
msgstr ""
#. module: golem_resource_account
#: model:ir.model.fields,field_description:golem_resource_account.field_golem_reservation_invoice_wizard_display_name
msgid "Display Name"
msgstr ""
#. module: golem_resource_account
#: model:ir.model,name:golem_resource_account.model_golem_resource_reservation
msgid "GOLEM Reservation Model"
msgstr ""
#. module: golem_resource_account
#: 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.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"
msgstr ""
#. module: golem_resource_account
#: model:ir.model.fields,field_description:golem_resource_account.field_golem_resource_reservation_invoice_line_id
msgid "Invoice line id"
msgstr ""
#. module: golem_resource_account
#: model:ir.ui.view,arch_db:golem_resource_account.golem_resource_reservation_search_inherit_golem_resource_account
msgid "Invoice state"
msgstr ""
#. module: golem_resource_account
#: model:ir.ui.view,arch_db:golem_resource_account.golem_resource_reservation_tree_inherit_golem_resource_account
msgid "Invoice status"
msgstr ""
#. module: golem_resource_account
#: model:ir.ui.view,arch_db:golem_resource_account.golem_resource_reservation_search_inherit_golem_resource_account
msgid "Invoiced"
msgstr ""
#. module: golem_resource_account
#: model:ir.ui.view,arch_db:golem_resource_account.golem_resource_reservation_form_inherit_golem_resource_account
msgid "Invoicing"
msgstr ""
#. module: golem_resource_account
#: 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_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_invoice_wizard_write_date
msgid "Last Updated on"
msgstr ""
#. module: golem_resource_account
#: model:ir.model.fields,field_description:golem_resource_account.field_golem_resource_reservation_resource_product_id
msgid "Linked product"
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.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
#: model:ir.ui.view,arch_db:golem_resource_account.golem_reservation_invoice_wizard_form
msgid "Reservations to invoice"
msgstr ""
#. module: golem_resource_account
#: model:ir.ui.view,arch_db:golem_resource_account.golem_resource_reservation_form_inherit_golem_resource_account
msgid "Show invoice"
msgstr ""
#. module: golem_resource_account
#: model:ir.model.fields,field_description:golem_resource_account.field_golem_resource_reservation_invoice_state
msgid "Status"
msgstr ""
#. module: golem_resource_account
#: code:addons/golem_resource_account/models/golem_resource_reservation.py:50
#, python-format
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: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
#: model:ir.model.fields,field_description:golem_resource_account.field_golem_resource_reservation_invoice_amount_total
msgid "Total"
msgstr ""
#. module: golem_resource_account
#: code:addons/golem_resource_account/models/golem_resource_reservation.py:52
#, python-format
msgid "You can not create an invoice as there is already one."
msgstr ""
#. module: golem_resource_account
#: code:addons/golem_resource_account/models/golem_resource_reservation.py:57
#, python-format
msgid "You can not create an invoice without linked product on the resource reserved."
msgstr ""
#. module: golem_resource_account
#: code:addons/golem_resource_account/models/golem_resource_reservation.py:43
#, python-format
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_invoice_wizard
msgid "golem.reservation.invoice.wizard"
msgstr ""

View File

@ -0,0 +1,20 @@
# -*- 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_reservation

View File

@ -0,0 +1,119 @@
# -*- 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, fields, api, _
from odoo.exceptions import ValidationError
class GolemResourceReservation(models.Model):
""" GOLEM Resource Reservation Adaptation """
_inherit = 'golem.resource.reservation'
resource_product_id = fields.Many2one(related='resource_id.product_tmpl_id')
invoice_line_id = fields.Many2one('account.invoice.line', copy=False)
invoice_line_price_subtotal = fields.Monetary(related='invoice_line_id.price_subtotal')
invoice_id = fields.Many2one(related='invoice_line_id.invoice_id',
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')
@api.multi
def check_before_invoicing(self):
""" Checks data coherence before invoicing """
if len(self.mapped('partner_id')) > 1:
raise ValidationError(_('You can\'t group reservations of multiple '
'clients in the same invoice, please remove '
'inadequate reservations'))
for reservation in self:
if reservation.state != "validated":
raise ValidationError(
_('The reservation "{}" is not validated, please validate '
'it before creating invoice'.format(reservation.name)))
if reservation.invoice_line_id:
raise ValidationError(_('You can not create an invoice as there '
'is already one.'))
product = reservation.resource_id.product_tmpl_id
if not product:
raise ValidationError(_('You can not create an invoice without '
'linked product on the resource reserved.'))
account_id = product.property_account_income_id.id or \
product.categ_id.property_account_income_categ_id.id
if not account_id:
raise ValidationError(
_('There is no income account defined for this product: "{}"'
'. You have to configure it on the product form.'.format(product.name)))
@api.multi
def create_invoice_line(self, invoice_id):
""" Create invoice line corresponding to reservation """
for reservation in self:
product = reservation.resource_id.product_tmpl_id
amount = product.list_price
account_id = product.property_account_income_id.id or \
product.categ_id.property_account_income_categ_id.id
delta = fields.Datetime.from_string(reservation.date_stop) - \
fields.Datetime.from_string(reservation.date_start)
quantity = (delta.days * 24) + (delta.seconds/3600.0)
line_id = self.env['account.invoice.line'].create({
'invoice_id': invoice_id.id,
'name': product.name,
'origin': reservation.name,
'price_unit': amount,
'quantity': quantity,
'uom_id': product.uom_id.id,
'account_id': account_id,
'product_id': product.product_variant_id.id,
})
reservation.invoice_line_id = line_id
@api.multi
def create_invoice(self):
""" Invoice creation """
for reservation in self:
reservation.check_before_invoicing()
inv_obj = self.env['account.invoice']
partner_id = reservation.partner_id
invoice_id = inv_obj.create({
'origin': reservation.name,
'type': 'out_invoice',
'reference': False,
'account_id': partner_id.property_account_receivable_id.id,
'partner_id': partner_id.id
})
reservation.create_invoice_line(invoice_id)
@api.multi
def show_invoice(self):
""" Redirects to linked invoice """
self.ensure_one()
reservation = self[0]
if reservation.invoice_id:
return {'type': 'ir.actions.act_window',
'res_model': 'account.invoice',
'res_id': reservation.invoice_id.id,
'view_mode': 'form',
'view_id': self.env.ref('account.invoice_form').id}

View 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_reservation_invoice

View File

@ -0,0 +1,120 @@
# -*- 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 TestGolemResourceReservation(TransactionCase):
""" GOLEM Resource Reservation testing """
def setUp(self, *args, **kwargs):
""" Bootstrap Resource Reservation """
super(TestGolemResourceReservation, self).setUp(*args, **kwargs)
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
})
self.resource = self.env['golem.resource'].create({
'name': 'Resource',
'avaibility_start': '2018-01-01',
'avaibility_stop': '2020-01-01',
'availibility_24_7': True
})
self.partner = self.env['res.partner'].create({'firstname': 'John',
'lastname': 'DOE',
'is_company': False})
self.partner2 = self.env['res.partner'].create({'firstname': 'John',
'lastname': 'DOE',
'is_company': False})
self.data = {
'resource_id': self.resource.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.data2 = {
'resource_id': self.resource.id,
'date_start': '2018-03-05 11:00:00', # is monday
'date_stop': '2018-03-05 12:00:00',
'partner_id': self.partner2.id
}
self.res_obj = self.env['golem.resource.reservation']
def test_single_reservation_invoice(self):
""" Test reservation bases """
reservation = self.res_obj.create(self.data)
self.assertEqual(reservation.state, 'draft')
self.assertFalse(reservation.invoice_id)
#try to create invoice withoud validating reservation
with self.assertRaises(ValidationError) as err:
reservation.create_invoice()
self.assertIn(u'is not validated, please validate it', err.exception.args[0])
reservation.state_confirm()
#try to create invoice with no product linked
with self.assertRaises(ValidationError) as err:
reservation.create_invoice()
self.assertIn(u'without linked product', err.exception.args[0])
reservation.resource_id.write({'product_tmpl_id': self.product.id})
reservation.create_invoice()
self.assertTrue(reservation.invoice_id)
self.assertEqual(reservation.invoice_id.state, 'draft')
def test_multiple_reservation_in(self):
""" Test Multiple Reservation Invoices """
reservation_1 = self.res_obj.create(self.data)
reservation_2 = self.res_obj.create(self.data2)
reservation_1.state_confirm()
reservation_2.state_confirm()
self.assertEqual(reservation_1.state, 'validated')
self.assertEqual(reservation_2.state, 'validated')
reservation_1.resource_id.product_tmpl_id = self.product.id
reservation_2.resource_id.product_tmpl_id = self.product.id
wizard = self.env['golem.reservation.invoice.wizard'].create({
'reservation_ids': [(4, reservation_1.id, 0), (4, reservation_2.id, 0)]})
self.assertTrue(wizard.reservation_ids)
self.assertEqual(wizard.reservation_ids[0], reservation_2)
self.assertEqual(wizard.reservation_ids[1], reservation_1)
#try to create invoice for to different client
with self.assertRaises(ValidationError) as err:
wizard.create_invoice()
self.assertIn(u'group reservations of multiple clients in the same',
err.exception.args[0])
#fixing the same client for both reservation
reservation_2.write({'partner_id': self.partner.id})
wizard.create_invoice()
self.assertTrue(reservation_1.invoice_id)
self.assertTrue(reservation_2.invoice_id)

View File

@ -0,0 +1,97 @@
<?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_reservation_tree_inherit_golem_resource_account">
<field name="name">GOLEM Resource Reservation Tree Adaptation to invoicing</field>
<field name="model">golem.resource.reservation</field>
<field name='inherit_id' ref="golem_resource.golem_resource_reservation_view_tree"/>
<field name="arch" type="xml">
<field name="state" position="after">
<field name="invoice_id" />
<field name="invoice_state" string="Invoice status" />
</field>
</field>
</record>
<!-- Forms -->
<record model="ir.ui.view"
id="golem_resource_reservation_form_inherit_golem_resource_account">
<field name="name"> GOLEM Resource Reservation Form Adaptations to invoicing</field>
<field name="model">golem.resource.reservation</field>
<field name='inherit_id' ref="golem_resource.golem_resource_reservation_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'), '|', ('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>
<group name="reservation" position="after">
<group name="invoicing" string="Invoicing"
attrs="{'invisible': [('invoice_id', '=', False)]}">
<field name="resource_product_id" />
<field name="invoice_id" />
<field name="invoice_state" />
<field name="invoice_amount_total" />
<field name="invoice_line_id" />
<field name="invoice_line_price_subtotal" />
</group>
</group>
</field>
</record>
<!-- Searches -->
<record model="ir.ui.view"
id="golem_resource_reservation_search_inherit_golem_resource_account">
<field name="name"> GOLEM Resource Reservation Search Adaptations</field>
<field name="model">golem.resource.reservation</field>
<field name='inherit_id'
ref="golem_resource.golem_resource_reservation_view_search"/>
<field name="arch" type="xml">
<field name="state" position="after">
<field name="invoice_id" string="Invoice"
filter_domain="[('invoice_id.number', 'ilike', self)]" />
</field>
<filter name="state_rejected" position="after">
<separator />
<filter name="invoiced" string="Invoiced"
domain="[('invoice_line_id', '!=', False)]" />
<filter name="not_invoiced" string="Not invoiced"
domain="[('state', '=', 'validated'), ('invoice_line_id', '=', False)]" />
</filter>
<filter name="group_state" position="after">
<filter name="group_invoice_state" string="Invoice state"
context="{'group_by': 'invoice_state'}" />
</filter>
</field>
</record>
<!-- Add option to the "More" button -->
<act_window id="action_golem_reservation_invoice_wizard"
name="Reservations to invoice"
res_model="golem.reservation.invoice.wizard"
src_model="golem.resource.reservation"
view_mode="form"
multi="True"
target="new" />
</data>
</odoo>

View File

@ -0,0 +1,20 @@
# -*- 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_invoice

View File

@ -0,0 +1,45 @@
# -*- 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 Invoice Wizard"""
from odoo import models, fields, api
class GolemReservationInvoiceWizard(models.TransientModel):
""" GOLEM Resource Reservation Invoice Wizard """
_name = 'golem.reservation.invoice.wizard'
reservation_ids = fields.Many2many(
'golem.resource.reservation', required=True, string='Reservations to invoice',
default=lambda self: self._context.get('active_ids', []))
@api.multi
def create_invoice(self):
""" Invoice creation """
self.ensure_one()
self.reservation_ids.check_before_invoicing()
self.reservation_ids[0].create_invoice()
invoice_id = self.reservation_ids[0].invoice_id
if len(self.reservation_ids) > 1:
self.reservation_ids[1:].create_invoice_line(invoice_id)
if self._context.get('open_invoice', False):
return self.reservation_ids[0].show_invoice()
return {'type': 'ir.actions.act_window_close'}

View File

@ -0,0 +1,47 @@
<?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_reservation_invoice_wizard_form">
<field name="name"> GOLEM Reservation Invoice Wizard Form</field>
<field name="model">golem.reservation.invoice.wizard</field>
<field name="arch" type="xml">
<form string="Reservations to invoice">
<p>
<strong>
Only one invoice will be created in draft with corresponding reservations.
Then, you will be redirected to the new invoice and can review it before validation.
</strong>
</p>
<footer>
<button name="create_invoice" string="Create and view invoice" type="object"
context="{'open_invoice': True}" class="oe_highlight" />
<button name="create_invoice" string="Create invoice and Close" type="object"
class="oe_highlight" />
<button string="Cancel" class="oe_link" special="cancel" />
</footer>
</form>
</field>
</record>
</data>
</odoo>