Merge branch 'master' into golem_resource_account

This commit is contained in:
Fabien BOURGEOIS 2018-03-26 17:59:49 +02:00
commit bd7a873b21
14 changed files with 560 additions and 200 deletions

View File

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

View File

@ -18,7 +18,7 @@
{
'name': 'GOLEM non-profit membership handling',
'summary': 'Extends Odoo membership',
'version': '10.0.1.1.2',
'version': '10.0.1.1.3',
'category': 'GOLEM',
'author': 'Fabien Bourgeois, Michel Dessenne',
'license': 'AGPL-3',
@ -27,5 +27,5 @@
'depends': ['golem_member', 'account', 'decimal_precision'],
'data': ['views/golem_membership_invoice.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',
'summary': 'GOLEM resources management',
'description': ''' GOLEM resources management ''',
'version': '10.0.1.10.0',
'version': '10.0.1.12.0',
'category': 'GOLEM',
'author': 'Youssef El Ouahby, Fabien Bourgeois',
'license': 'AGPL-3',

View File

@ -6,8 +6,8 @@ msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 10.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-03-17 08:07+0000\n"
"PO-Revision-Date: 2018-03-17 08:07+0000\n"
"POT-Creation-Date: 2018-03-26 15:36+0000\n"
"PO-Revision-Date: 2018-03-26 15:36+0000\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
@ -95,6 +95,11 @@ msgstr "Confirmer"
msgid "Confirmed"
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
#: 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
@ -134,6 +139,7 @@ msgstr "Nom affiché"
#. module: golem_resource
#: selection:golem.resource.reservation,state:0
#: model:ir.ui.view,arch_db:golem_resource.golem_resource_reservation_view_search
msgid "Draft"
msgstr "Brouillon"
@ -320,6 +326,7 @@ msgstr "Rejet"
#. 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é"
@ -344,11 +351,6 @@ msgstr "Nombre de réservations"
msgid "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
#: 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
@ -407,6 +409,11 @@ 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"
@ -499,6 +506,7 @@ msgstr "Valider"
#. module: golem_resource
#: selection:golem.resource.reservation,state:0
#: model:ir.ui.view,arch_db:golem_resource.golem_resource_reservation_view_search
msgid "Validated"
msgstr "Validé"

View File

@ -6,8 +6,8 @@ msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 10.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-03-17 08:07+0000\n"
"PO-Revision-Date: 2018-03-17 08:07+0000\n"
"POT-Creation-Date: 2018-03-26 15:37+0000\n"
"PO-Revision-Date: 2018-03-26 15:37+0000\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
@ -95,6 +95,11 @@ msgstr ""
msgid "Confirmed"
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
#: 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
@ -134,6 +139,7 @@ msgstr ""
#. module: golem_resource
#: selection:golem.resource.reservation,state:0
#: model:ir.ui.view,arch_db:golem_resource.golem_resource_reservation_view_search
msgid "Draft"
msgstr ""
@ -320,6 +326,7 @@ msgstr ""
#. 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 ""
@ -344,11 +351,6 @@ msgstr ""
msgid "Reservation id"
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
#: 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
@ -407,6 +409,11 @@ 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"
@ -499,6 +506,7 @@ msgstr ""
#. module: golem_resource
#: selection:golem.resource.reservation,state:0
#: model:ir.ui.view,arch_db:golem_resource.golem_resource_reservation_view_search
msgid "Validated"
msgstr ""

View File

@ -70,7 +70,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
</header>
<sheet>
<group>
<group string="Resource">
<group name="resource" string="Resource">
<field name="id" invisible="1" />
<field name="resource_id" options="{'no_create': True}" />
<field name="resource_avaibility_24_7" readonly="1" />
@ -79,7 +79,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<field name="resource_timetable_ids" readonly="1"
attrs="{'invisible': [('resource_avaibility_24_7', '=', True)]}" />
</group>
<group string="Reservation">
<group name="reservation" string="Reservation">
<group>
<field name="date_start" />
<field name="date_stop" />
@ -113,8 +113,14 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<field name="user_id" />
<field name="partner_id" />
<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')]" />
<filter name="state_validated" string="Validated"
domain="[('state', '=', 'validated')]" />
<filter name="state_rejected" string="Rejected"
domain="[('state', '=', 'rejected')]" />
<filter name="group_state" string="State"
context="{'group_by': 'state'}" />
<filter name="group_resource" string="Resource"

View File

@ -135,6 +135,9 @@ 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>

View File

@ -26,8 +26,7 @@
'license': 'AGPL-3',
'application': True,
'installable': True,
'depends': ['golem_resource',
'account'],
'data': ['views/golem_resource_reservation_views.xml',
'wizard/golem_reservation_invoice.xml']
'depends': ['golem_resource', 'account'],
'data': ['wizard/golem_reservation_invoice_views.xml',
'views/golem_resource_reservation_views.xml']
}

View File

@ -0,0 +1,192 @@
# 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-26 15:14+0000\n"
"PO-Revision-Date: 2018-03-26 15:14+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_reservation_invoice_wizard_form
#: 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.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:57
#, 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:43
#, 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:48
#, 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
#: 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,186 @@
# 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-26 15:13+0000\n"
"PO-Revision-Date: 2018-03-26 15:13+0000\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"
#. module: golem_resource_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_reservation_invoice_wizard_form
#: 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.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:57
#, 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:43
#, 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:48
#, python-format
msgid "You can not create an invoice without linked product on the resource reserved."
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

@ -18,101 +18,98 @@
""" GOLEM Resource Reservation Adaptation"""
from odoo import models, fields, api, _
from odoo.exceptions import UserError
from odoo.exceptions import ValidationError
class GolemResourceReservation(models.Model):
""" GOLEM Resource Reservation Adaptation """
_inherit = 'golem.resource.reservation'
invoice_id = fields.Many2one('account.invoice')
invoicing_state = fields.Char(compute="_compute_invoicing_state",
search='_search_invoicing_state',
string="Invoicing Status",
default="None")
def _search_invoicing_state(self, operator, value):
if value == "None":
reservation = self.env['golem.resource.reservation'].search(
[('invoice_id', '=', False)])
return [('id', 'in', reservation.mapped('id'))]
else:
return [('invoice_id.state', operator, value)]
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
@api.depends('invoice_id')
def _compute_invoicing_state(self):
""" Compute invoicing_state """
def check_before_invoicing(self):
""" Checks data coherence before invoicing """
for reservation in self:
if reservation.invoice_id:
reservation.invoicing_state = reservation.invoice_id.state
else:
reservation.invoicing_state = "None"
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 open_invoice(self):
""" open invoice """
def create_invoice_line(self, invoice_id):
""" Create invoice line corresponding to reservation """
for reservation in self:
if reservation.invoice_id:
return {'name' : _('Reservation Invoice'),
'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,
'target': 'current'}
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.id,
})
reservation.invoice_line_id = line_id
@api.multi
def create_invoice(self):
""" Create invoice """
""" Invoice creation """
for reservation in self:
if reservation.state != "validated":
raise UserError(
_("The reservation '%s' is not validated, please validate it before \
creating invoice") % reservation.name)
reservation.check_before_invoicing()
inv_obj = self.env['account.invoice']
partner_id = reservation.partner_id
product = reservation.resource_id.product_tmpl_id
amount = product.standard_price
delta = fields.Datetime.from_string(reservation.date_stop) - \
fields.Datetime.from_string(reservation.date_start)
quantity = (delta.days * 24) + (delta.seconds/3600.0)
account_id = False
if not product:
raise UserError(
_("There is no product linked to resource : '%s', you can't invoice \
reservation with no product linked") % (reservation.resource_id.name,))
if product.id:
account_id = product.property_account_income_id.id
if not account_id:
account_id = product.categ_id.property_account_income_categ_id.id
if not account_id:
raise UserError(
_('There is no income account defined for this product: "%s". \
You may have to install a chart of account from Accounting \
app, settings menu.') % (product.name,))
invoice = inv_obj.create({
'name': reservation.name,
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,
'invoice_line_ids': [(0, 0, {
'name': reservation.resource_id.name,
#'origin': ,
'account_id': account_id,
'price_unit': amount,
'quantity': quantity,
'discount': 0.0,
'uom_id': product.uom_id.id,
'product_id': product.id,
})],
})
reservation.invoice_id = invoice.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

@ -28,7 +28,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<attribute name="colors">red : invoicing_state=='open'; green : invoicing_state=='paid'; black: state=='draft'; blue : state=='validated'; grey : state=='canceled'; orange : state=='rejected'</attribute>
</xpath>
<field name="state" position="after">
<field name="invoicing_state"/>
<field name="invoice_id" />
<field name="invoice_state" string="Invoice status" />
</field>
</field>
</record>
@ -41,37 +42,51 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<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 New Invoice" class="oe_highlight"
attrs="{'invisible': ['|', ('state', 'not in', 'validated'),
'|',('id', '=', False), ('invoicing_state', '=', 'paid')]}" />
<button name="open_invoice" type="object" string="Open Invoice" class="oe_highlight"
attrs="{'invisible': [('invoicing_state', '==', 'None')]}" />
<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>
<field name="partner_id" position="after">
<field name="invoicing_state" readonly="1" />
</field>
<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 to invoicing</field>
<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='inherit_id'
ref="golem_resource.golem_resource_reservation_view_search"/>
<field name="arch" type="xml">
<search position="inside">
<filter name="to_invoice" string="Reservation To Invoice"
domain="[('invoicing_state', '=', 'None')]" />
<filter name="invoice_draft" string="Invoice Draft"
domain="[('invoicing_state', '=', 'draft')]" />
<filter name="invoice_open" string="Invoice Open"
domain="[('invoicing_state', '=', 'open')]" />
<filter name="invoice_paid" string="Invoice Paid"
domain="[('invoicing_state', '=', 'paid')]" />
</search>
<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>-->
</record>
<!-- Add option to the "More" button -->
<act_window id="action_golem_reservation_invoice_wizard"
name="Reservations to invoice"
@ -79,7 +94,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
src_model="golem.resource.reservation"
view_mode="form"
multi="True"
target="new"
/>
target="new" />
</data>
</odoo>

View File

@ -18,86 +18,28 @@
""" GOLEM Reservation Invoice Wizard"""
from odoo import models, fields, api, _
from odoo.exceptions import ValidationError, UserError
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',
default=lambda self: self._context.get('active_ids', []),
string='Reservations to invoice')
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_invoices(self):
""" Create invoices for reservation """
def create_invoice(self):
""" Invoice creation """
self.ensure_one()
if self.reservation_ids:
inv_obj = self.env['account.invoice']
partner_id = self.reservation_ids[0].partner_id
product = self.reservation_ids[0].resource_id.product_tmpl_id
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 product.id:
account_id = product.property_account_income_id.id
if not account_id:
account_id = product.categ_id.property_account_income_categ_id.id
if not account_id:
raise UserError(
_('There is no income account defined for this product: "%s". \
You may have to install a chart of account from Accounting \
app, settings menu.') % (product.name,))
lines = []
for reservation in self.reservation_ids:
if reservation.state != "validated":
raise UserError(
_("The reservation '%s' is not validated, please validate it before \
creating invoice") % reservation.name)
product = reservation.resource_id.product_tmpl_id
if not product:
raise UserError(
_("There is no product linked to resource : '%s', you can't invoice \
reservation with no product linked") % (reservation.resource_id.name,))
if partner_id != reservation.partner_id:
raise UserError(
_("You can't group reservations of multiple clients in the same \
invoice, please remove inadequate reservations"))
amount = product.standard_price
delta = fields.Datetime.from_string(reservation.date_stop) - \
fields.Datetime.from_string(reservation.date_start)
quantity = (delta.days * 24) + (delta.seconds/3600.0)
lines.append((0, 0, {
'name': reservation.resource_id.name,
#'origin': ,
'account_id': account_id,
'price_unit': amount,
'quantity': quantity,
'discount': 0.0,
'uom_id': product.uom_id.id,
'product_id': product.id,
}))
invoice = inv_obj.create({
#'name': reservation.name,
#'origin': ,
'type': 'out_invoice',
'reference': False,
'account_id': partner_id.property_account_receivable_id.id,
'partner_id': partner_id.id,
'invoice_line_ids': lines,
})
self.reservation_ids.write({'invoice_id': invoice.id})
if self._context.get('open_invoices', False):
return {'name' : _('Reservation Invoice'),
'type' : 'ir.actions.act_window',
'res_model' : 'account.invoice',
'res_id' : invoice.id,
'view_mode': 'form',
'view_id': self.env.ref('account.invoice_form').id,
'target': 'current'}
return {'type': 'ir.actions.act_window_close'}
if self._context.get('open_invoice', False):
return self.reservation_ids[0].show_invoice()
return {'type': 'ir.actions.act_window_close'}

View File

@ -18,24 +18,28 @@ 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="Reservation to invoice">
<label string="Invoices will be created in draft so that you can review them before validation" />
<field name="reservation_ids" />
<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_invoices" string="Create and View Invoices" type="object"
context="{'open_invoices': True}" class="oe_highlight" />
<button name="create_invoices" string="Create Invoices" type="object"
<button name="create_invoice" string="Create Invoice" type="object"
class="oe_highlight" />
<button string="Cancel" class="oe_link" special="cancel" />
</footer>
</form>
</field>
</record>
</data>
</odoo>